tools:proc/readproc.c: remove explicit NULL check before free
PATCH 3/8 tools:proc/readproc.c: remove explicit NULL check before free
No need of NULL check before free
Signed-off-by Maninder Singh <[email protected]>
Signed-off-by Akhilesh Kumar <[email protected]>
--- tools/top-LTP/proc/readproc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
tools/top-LTP/proc/readproc.c +2 -4
@@ -275,8 +275,7 @@ static char **file2strvec(const char *directory, const char *what)if (n ==0 && rbuf ==0 )return NULL ;/* process died between our open and read */ if (n <0 ) { -if (rbuf) -free (rbuf); +free (rbuf);return NULL ;/* read error */ }if (end_of_file && buf[n -1 ])/* last read char not null */
@@ -289,8 +288,7 @@ static char **file2strvec(const char *directory, const char *what) }close (fd);if (n <=0 && !end_of_file) { -if (rbuf) -free (rbuf); +free (rbuf);return NULL ;/* read error */ } endbuf = rbuf + tot;/* count space for pointers */
Signature · 7 lines
1.7.9.5 ------------------------------------------------------------------------------ _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list