diff src/logerr.c @ 5579:22d473eabfcc draft

Linux: fix a memory leak when dhcpcd exits or the log is reopened
author Roy Marples <roy@marples.name>
date Sun, 24 Jan 2021 22:53:20 +0000
parents 071a9ea18363
children
line wrap: on
line diff
--- a/src/logerr.c	Sun Jan 24 22:22:25 2021 +0000
+++ b/src/logerr.c	Sun Jan 24 22:53:20 2021 +0000
@@ -484,13 +484,14 @@
 #endif
 
 	closelog();
+#if defined(__linux__)
+	free(_logprog);
+	_logprog = NULL;
+#endif
 #ifndef SMALL
 	if (ctx->log_file == NULL)
 		return;
 	fclose(ctx->log_file);
 	ctx->log_file = NULL;
 #endif
-#if defined(__linux__)
-	free(_logprog);
-#endif
 }