fixed memory leak in tools.c and fixed allocation size of ChanUser entries
[NeonServV5.git] / src / tools.c
index 2cb1065fa8458b33b2235200e3269f79a1e48558..51402a092467d40e6290b6caf4272d639215bef1 100644 (file)
@@ -416,6 +416,8 @@ void flushModeBuffer(struct ModeBuffer *modeBuf) {
             modeStr[modePos++] = modeBuf->addModes[i];
             if(modeBuf->addModesParams[i]) {
                 paramPos += sprintf(paramStr + paramPos, " %s", modeBuf->addModesParams[i]);
+                free(modeBuf->addModesParams[i]);
+                modeBuf->addModesParams[i] = NULL;
             }
         }
         modeBuf->addCount = 0;
@@ -426,6 +428,8 @@ void flushModeBuffer(struct ModeBuffer *modeBuf) {
             modeStr[modePos++] = modeBuf->delModes[i];
             if(modeBuf->delModesParams[i]) {
                 paramPos += sprintf(paramStr + paramPos, " %s", modeBuf->delModesParams[i]);
+                free(modeBuf->delModesParams[i]);
+                modeBuf->delModesParams[i] = NULL;
             }
         }
         modeBuf->delCount = 0;