diff --git a/Changes b/Changes index adbfa8490..ee2d4258d 100644 --- a/Changes +++ b/Changes @@ -859,3 +859,5 @@ This feature has been suggested for several years (and refused), but the final suggestion (with implementation specific hints) came from Gilou in bug #0002207. - Fixed win32 makefile, now compiles fine. +- Fixed (important?) reference count bug regarding sptr->serv->conf. I don't know what + effects this caused (memory corruption?), but it didn't look good ;). diff --git a/src/modules/m_server.c b/src/modules/m_server.c index e9e11c3d6..1f1468c82 100644 --- a/src/modules/m_server.c +++ b/src/modules/m_server.c @@ -179,9 +179,16 @@ DLLFUNC CMD_FUNC(m_server) strcpy(xerrmsg, "Null servername"); goto errlink; } - for(link = conf_link; link; link = (ConfigItem_link *) link->next) - if (!match(link->servername, servername)) - break; + if (cptr->serv && cptr->serv->conf) + { + /* We already know what block we are dealing with (outgoing connect!) */ + link = cptr->serv->conf; + } else { + /* Hunt the linkblock down ;) */ + for(link = conf_link; link; link = (ConfigItem_link *) link->next) + if (!match(link->servername, servername)) + break; + } if (!link) { snprintf(xerrmsg, 256, "No link block named '%s'", servername); goto errlink;