From 4fe4a42959a6634f59cf6f45c58a07da5b29cd45 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Sun, 10 Feb 2013 16:08:55 +0100 Subject: [PATCH] RNCFG: if we are going to overwrite the contents of a pointer, free these contents. --- citadel/netconfig.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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)); -- 2.30.2