summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: df8e5c1)
raw | patch | inline | side by side (parent: df8e5c1)
author | Florian Forster <octo@collectd.org> | |
Fri, 19 Jun 2015 08:54:02 +0000 (10:54 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Fri, 19 Jun 2015 08:54:02 +0000 (10:54 +0200) |
src/gmond.c | patch | blob | history |
diff --git a/src/gmond.c b/src/gmond.c
index ff4936d1d9767f810c8de2281568e8aceaa0ae0d..7c9028a1490ffd2a345b83538383c2fd8e33b10d 100644 (file)
--- a/src/gmond.c
+++ b/src/gmond.c
struct addrinfo *ai_ptr;
int ai_return;
- socket_entry_t *sockets;
- size_t sockets_num;
+ socket_entry_t *sockets = NULL;
+ size_t sockets_num = 0;
int status;
-
- sockets = *ret_sockets;
- sockets_num = *ret_sockets_num;
+
+ if (*ret_sockets != NULL)
+ return (EINVAL);
memset (&ai_hints, 0, sizeof (ai_hints));
ai_hints.ai_flags = 0;
freeaddrinfo (ai_list);
- if ((*ret_sockets_num) >= sockets_num)
+ if (sockets_num == 0)
+ {
+ sfree (sockets);
return (-1);
+ }
*ret_sockets = sockets;
*ret_sockets_num = sockets_num;