From: James Jones Date: Fri, 13 May 2022 21:29:49 +0000 (-0500) Subject: Make load_noinstall_path() free what it doesn't return (CID #1504304) (#4500) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d9e654520be7e96cf02c96bd1f0629b958d675c8;p=thirdparty%2Ffreeradius-server.git Make load_noinstall_path() free what it doesn't return (CID #1504304) (#4500) --- diff --git a/scripts/jlibtool.c b/scripts/jlibtool.c index d4c58eea333..75cef0b75cc 100644 --- a/scripts/jlibtool.c +++ b/scripts/jlibtool.c @@ -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. */