From: Karel Zak Date: Tue, 28 May 2019 11:11:14 +0000 (+0200) Subject: setpriv: fix memory leak in local scope [coverity scan] X-Git-Tag: v2.34-rc2~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=da14a74df9eeb64d6168e7d13412ac1519c39717;p=thirdparty%2Futil-linux.git setpriv: fix memory leak in local scope [coverity scan] Signed-off-by: Karel Zak --- diff --git a/sys-utils/setpriv.c b/sys-utils/setpriv.c index 717031d94a..e612f7269d 100644 --- a/sys-utils/setpriv.c +++ b/sys-utils/setpriv.c @@ -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);