summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 214995c)
raw | patch | inline | side by side (parent: 214995c)
author | Florian Forster <ff@octo.it> | |
Tue, 9 May 2017 06:38:08 +0000 (08:38 +0200) | ||
committer | Florian Forster <ff@octo.it> | |
Tue, 9 May 2017 06:38:08 +0000 (08:38 +0200) |
free(3) handles NULL pointers correctly, so these checks are not needed.
src/liboping.c | patch | blob | history |
diff --git a/src/liboping.c b/src/liboping.c
index b6c80f2f479e875a63d26a7d47ca6f685e854a93..0c9016e76a9582b7f55b634d3c306d3097788e15 100644 (file)
--- a/src/liboping.c
+++ b/src/liboping.c
static void ping_free (pinghost_t *ph)
{
- if (ph->username != NULL)
- free (ph->username);
-
- if (ph->hostname != NULL)
- free (ph->hostname);
+ if (ph == NULL)
+ return;
- if (ph->data != NULL)
- free (ph->data);
+ free (ph->username);
+ free (ph->hostname);
+ free (ph->data);
free (ph);
}
current = next;
}
- if (obj->data != NULL)
- free (obj->data);
-
- if (obj->srcaddr != NULL)
- free (obj->srcaddr);
-
- if (obj->device != NULL)
- free (obj->device);
+ free (obj->data);
+ free (obj->srcaddr);
+ free (obj->device);
if (obj->fd4 != -1)
close(obj->fd4);