From: Wilfried Goesgens Date: Sun, 10 Feb 2013 15:08:55 +0000 (+0100) Subject: RNCFG: if we are going to overwrite the contents of a pointer, free these contents. X-Git-Tag: v8.20~118 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=4fe4a42959a6634f59cf6f45c58a07da5b29cd45 RNCFG: if we are going to overwrite the contents of a pointer, free these contents. --- diff --git a/citadel/netconfig.c b/citadel/netconfig.c index 0f89d4474..916835e53 100644 --- a/citadel/netconfig.c +++ b/citadel/netconfig.c @@ -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));