RNCFG: if we are going to overwrite the contents of a pointer, free these contents.
authorWilfried Goesgens <dothebart@citadel.org>
Sun, 10 Feb 2013 15:08:55 +0000 (16:08 +0100)
committerWilfried Goesgens <dothebart@citadel.org>
Sun, 10 Feb 2013 15:08:55 +0000 (16:08 +0100)
citadel/netconfig.c

index 0f89d4474aa3468ed0ef0919a94f52a0232d8afa..916835e53465f53f98b6f281674197ce1067e4ad 100644 (file)
@@ -165,7 +165,7 @@ int ReadRoomNetConfigFile(OneRoomNetCfg **pOneRNCfg, char *filename)
        const CfgLineType *pCfg;
        StrBuf *Line;
        StrBuf *InStr;
-       OneRoomNetCfg *OneRNCfg;
+       OneRoomNetCfg *OneRNCfg = NULL;
 
        fd = open(filename, O_NONBLOCK|O_RDONLY);
        if (fd == -1) {
@@ -173,7 +173,10 @@ int ReadRoomNetConfigFile(OneRoomNetCfg **pOneRNCfg, char *filename)
                return 0;
        }
        if (*pOneRNCfg != NULL)
+       {
                OneRNCfg = *pOneRNCfg;
+               FreeRoomNetworkStructContent (OneRNCfg);
+       }
        else
                OneRNCfg = malloc(sizeof(OneRoomNetCfg));
        memset(OneRNCfg, 0, sizeof(OneRoomNetCfg));