]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Make load_noinstall_path() free what it doesn't return (CID #1504304) (#4500)
authorJames Jones <jejones3141@gmail.com>
Fri, 13 May 2022 21:29:49 +0000 (16:29 -0500)
committerGitHub <noreply@github.com>
Fri, 13 May 2022 21:29:49 +0000 (17:29 -0400)
scripts/jlibtool.c

index d4c58eea3336a1d08e803e0ac6f8df55e8091ab9..75cef0b75cc53503a903d78bdd2196c8c3d17b17 100644 (file)
@@ -1640,10 +1640,12 @@ static char *load_noinstall_path(char const *arg, int pathlen)
 
        if (target->has_realpath) {
                expanded_path = lt_malloc(PATH_MAX);
-               expanded_path = realpath(newarg, expanded_path);
                /* Uh, oh.  There was an error.  Fall back on our first guess. */
-               if (!expanded_path) {
+               if (!realpath(newarg, expanded_path)) {
+                       lt_const_free(expanded_path);
                        expanded_path = newarg;
+               } else {
+                       lt_const_free(newarg);
                }
        } else {
                /* We might get ../ or something goofy.  Oh, well. */