summaryrefslogtreecommitdiffstats
path: root/sys-utils
diff options
context:
space:
mode:
authorKarel Zak2019-05-28 13:11:14 +0200
committerKarel Zak2019-05-28 13:11:14 +0200
commitda14a74df9eeb64d6168e7d13412ac1519c39717 (patch)
tree0358838f92dcf4c4c1d52bd2edbf52d7bd002f66 /sys-utils
parentsetarch: avoid NULL dereference [coverity check] (diff)
downloadkernel-qcow2-util-linux-da14a74df9eeb64d6168e7d13412ac1519c39717.tar.gz
kernel-qcow2-util-linux-da14a74df9eeb64d6168e7d13412ac1519c39717.tar.xz
kernel-qcow2-util-linux-da14a74df9eeb64d6168e7d13412ac1519c39717.zip
setpriv: fix memory leak in local scope [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils')
-rw-r--r--sys-utils/setpriv.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys-utils/setpriv.c b/sys-utils/setpriv.c
index 717031d94..e612f7269 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);