]> git.ozlabs.org Git - ppp.git/commitdiff
Revert "pppd/options.c: fix memory leak on error path (#441)" (#562)
authorJaco Kroon <jaco@uls.co.za>
Sat, 19 Jul 2025 05:30:18 +0000 (07:30 +0200)
committerGitHub <noreply@github.com>
Sat, 19 Jul 2025 05:30:18 +0000 (15:30 +1000)
This reverts commit 26d1b60f4984fe71005c4f1a99691e714920f33c.

Additionally a comment is added so anyone looking at Coverity output
will not be tempted to "fix" it again.

Closes: #560
Signed-off-by: Jaco Kroon <jaco@uls.co.za>
pppd/options.c

index 36430784a02213a8543ec4f43c9ebdea9239a314..dc993dbb5ea81e404e936cbeb43441d807ffc7f3 100644 (file)
@@ -613,9 +613,13 @@ ppp_options_from_file(char *filename, int must_exist, int check_prot, int priv)
 
 err:
     fclose(f);
-    free(option_source);
     privileged_option = oldpriv;
     option_source = oldsource;
+
+    /* Note that we usually leak option_source here.  This is OK
+     * since this code is only run during startup.  Other places
+     * makes copies of the pointer (shallow copy), and as such we
+     * have no choice but to leak that here */
     return ret;
 }