]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
setpriv: fix memory leak in local scope [coverity scan]
authorKarel Zak <kzak@redhat.com>
Tue, 28 May 2019 11:11:14 +0000 (13:11 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 28 May 2019 11:11:14 +0000 (13:11 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/setpriv.c

index 717031d94a36bdab36429c1ac2cb941bbc6caf78..e612f7269d8acc33b8bde855b66f585f69266f7e 100644 (file)
@@ -700,8 +700,10 @@ static void do_reset_environ(struct passwd *pw)
 #else
        environ = NULL;
 #endif
-       if (term)
+       if (term) {
                xsetenv("TERM", term, 1);
+               free(term);
+       }
 
        if (pw->pw_shell && *pw->pw_shell)
                xsetenv("SHELL", pw->pw_shell, 1);