[PATCH 06/14] libmount, col: remove redundant null checks [smatch scan]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



libmount/src/context_umount.c:174 mnt_context_find_umount_fs() info: redundant null check on loopdev calling free()
libmount/src/context_umount.c:179 mnt_context_find_umount_fs() info: redundant null check on loopdev calling free()
text-utils/col.c:406 flush_lines() info: redundant null check on l->l_line calling free()

Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 libmount/src/context_umount.c | 6 ++----
 text-utils/col.c              | 3 +--
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c
index 96ae87a..b948459 100644
--- a/libmount/src/context_umount.c
+++ b/libmount/src/context_umount.c
@@ -170,13 +170,11 @@ try_loopdev:
 	}
 
 	*pfs = fs;
-	if (loopdev)
-		free(loopdev);
+	free(loopdev);
 
 	return fs ? 0 : 1;
 err:
-	if (loopdev)
-		free(loopdev);
+	free(loopdev);
 	return rc;
 }
 
diff --git a/text-utils/col.c b/text-utils/col.c
index 474b33f..9aa6a41 100644
--- a/text-utils/col.c
+++ b/text-utils/col.c
@@ -402,8 +402,7 @@ void flush_lines(int nflush)
 			flush_line(l);
 		}
 		nblank_lines++;
-		if (l->l_line)
-			free((void *)l->l_line);
+		free((void *)l->l_line);
 		free_line(l);
 	}
 	if (lines)
-- 
1.8.2.1

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux