when failing by OOM, don't loose any more memory.
authorWilfried Goesgens <dothebart@citadel.org>
Thu, 31 May 2012 21:43:32 +0000 (23:43 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Thu, 31 May 2012 21:43:32 +0000 (23:43 +0200)
citadel/msgbase.c

index 706230774bff5bcebf07eef3c733c7bf746fe340..a1acc98c4221cf7832a5a398bf4e8a6518b7152a 100644 (file)
@@ -2753,6 +2753,7 @@ int CtdlSaveMsgPointersInRoom(char *roomname, long newmsgidlist[], int num_newms
        msglist = realloc(msglist, (sizeof(long) * (num_msgs + num_msgs_to_be_merged)) );
        if (msglist == NULL) {
                MSGM_syslog(LOG_ALERT, "ERROR: can't realloc message list!\n");
+               free(msgs_to_be_merged);
                return (ERROR + INTERNAL_ERROR);
        }
        memcpy(&msglist[num_msgs], msgs_to_be_merged, (sizeof(long) * num_msgs_to_be_merged) );