summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b9b6fb7)
raw | patch | inline | side by side (parent: b9b6fb7)
author | Esteban Sanchez <esteban.sanchez@artica.es> | |
Tue, 27 Mar 2007 09:06:56 +0000 (11:06 +0200) | ||
committer | Florian Forster <octo@verplant.org> | |
Tue, 27 Mar 2007 09:06:56 +0000 (11:06 +0200) |
src/liboping.c | patch | blob | history |
diff --git a/src/liboping.c b/src/liboping.c
index f749301efc350e80d734248da9e718791a661020..9b91b6d40f0214963c025aeb6af9e7f3f4246575 100644 (file)
--- a/src/liboping.c
+++ b/src/liboping.c
ph->addr = (struct sockaddr_storage *) (ph->timer + 1);
ph->addrlen = sizeof (struct sockaddr_storage);
+ ph->fd = -1;
ph->latency = -1.0;
ph->ident = ping_get_ident () & 0xFFFF;
static void ping_free (pinghost_t *ph)
{
+ if (ph->fd >= 0)
+ close (ph->fd);
+
if (ph->hostname != NULL)
free (ph->hostname);
if (ph->fd < 0)
{
- free (ph->hostname);
- free (ph);
+ ping_free (ph);
return (-1);
}
else
pre->next = cur->next;
- if (cur->fd >= 0)
- close (cur->fd);
-
ping_free (cur);
return (0);