No need of NULL check before free Signed-off-by: Maninder Singh <maninder...@samsung.com> Signed-off-by: Akhilesh Kumar <akhiles...@samsung.com> --- .../controllers/cpuset/cpuset_lib/libcpuset.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/testcases/kernel/controllers/cpuset/cpuset_lib/libcpuset.c b/testcases/kernel/controllers/cpuset/cpuset_lib/libcpuset.c index d2d3c12..83ff5cd 100644 --- a/testcases/kernel/controllers/cpuset/cpuset_lib/libcpuset.c +++ b/testcases/kernel/controllers/cpuset/cpuset_lib/libcpuset.c @@ -601,8 +601,7 @@ static void update_mask_sizes() nodemask_sz = s2nbits(buf + strlen(nodemask_prefix)); } done: - if (buf != NULL) - free(buf); + free(buf); if (fp != NULL) fclose(fp); if (cpumask_sz == 0) @@ -634,8 +633,7 @@ err: bitmask_free(cp->cpus); if (cp && cp->mems) bitmask_free(cp->mems); - if (cp) - free(cp); + free(cp); return NULL; } @@ -2588,8 +2586,7 @@ static void add_pidblock(const char *file, struct pidblock **ppbhead) err: if (fp) fclose(fp); - if (pb) - free(pb); + free(pb); } static void read_task_file(const char *relpath, struct pidblock **ppbhead) @@ -2722,8 +2719,7 @@ void cpuset_freepidlist(struct cpuset_pidlist *pl) { if (pl && pl->pids) free(pl->pids); - if (pl) - free(pl); + free(pl); } static int __cpuset_move(pid_t pid, const char *path) @@ -3655,8 +3651,7 @@ eol: err: if (elinenum) *elinenum = linenum; - if (linebuf) - free(linebuf); + free(linebuf); return -1; } -- 1.7.9.5 ------------------------------------------------------------------------------ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list