]> git.ozlabs.org Git - ppp.git/commitdiff
pppd/options.c: fix memory leak on error path (#441)
authorIlya Shipitsin <chipitsine@gmail.com>
Fri, 1 Sep 2023 11:57:55 +0000 (13:57 +0200)
committerGitHub <noreply@github.com>
Fri, 1 Sep 2023 11:57:55 +0000 (21:57 +1000)
found by Coverity

602err:
603    fclose(f);
604    privileged_option = oldpriv;
   CID 436193 (#1 of 1): Resource leak (RESOURCE_LEAK)10. overwrite_var: Overwriting option_source in option_source = oldsource leaks the storage that option_source points to.
605    option_source = oldsource;

Signed-off-by: Ilya Shipitsin <chipitsine@gmail.com>
pppd/options.c

index 4b3e93ed1fbdc93c07d2847e58e230d837619c89..227e615c956154b9e14676a0e0f5f1fa58ac41fc 100644 (file)
@@ -601,6 +601,7 @@ 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;
     return ret;