diff options
author | Stephen Hemminger <stephen@networkplumber.org> | 2023-05-10 08:16:40 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen@networkplumber.org> | 2023-05-10 08:16:40 -0700 |
commit | cfb60ba56bf35f28505e7ff67f1efd9bd3e1d5c6 (patch) | |
tree | d95beebba6ec05f33ffefbbcb9f9cd1e5ace5a6e /lib | |
parent | eb64e268354ab68b4737187200b8769ae158a455 (diff) | |
download | iproute2-cfb60ba56bf35f28505e7ff67f1efd9bd3e1d5c6.tar.gz |
remove unnecessary checks for NULL before calling free()
The function free() handles the case wher argument is NULL
by doing nothing. So the extra checks are not needed.
Found by modified version of kernel coccinelle script.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/utils.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/utils.c b/lib/utils.c index b740531a..8dc302bd 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -1707,8 +1707,7 @@ int do_batch(const char *name, bool force, } } - if (line) - free(line); + free(line); return ret; } |