[lxc-devel] [lxc/master] coverity: #1438392

2xsec on Github lxc-bot at linuxcontainers.org
Tue Aug 14 04:31:38 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 379 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180814/1b556224/attachment.bin>
-------------- next part --------------
From 6926e3b80ede8f19d02ad58fc160b5b4b6aff58e Mon Sep 17 00:00:00 2001
From: 2xsec <dh48.jeong at samsung.com>
Date: Tue, 14 Aug 2018 13:29:50 +0900
Subject: [PATCH] coverity: #1438392

Dereference before null check

Signed-off-by: 2xsec <dh48.jeong at samsung.com>
---
 src/lxc/pam/pam_cgfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/lxc/pam/pam_cgfs.c b/src/lxc/pam/pam_cgfs.c
index 6d1d468d9..2975b6456 100644
--- a/src/lxc/pam/pam_cgfs.c
+++ b/src/lxc/pam/pam_cgfs.c
@@ -1897,8 +1897,7 @@ static bool cg_filter_and_set_cpus(char *path, bool am_initialized)
 copy_parent:
 	*lastslash = oldv;
 
-	if (fpath)
-		free(fpath);
+	free(fpath);
 
 	fpath = must_make_path(path, "cpuset.cpus", NULL);
 	ret = write_to_file(fpath, cpulist, strlen(cpulist), false);


More information about the lxc-devel mailing list