summaryrefslogtreecommitdiffstats
path: root/libasyncns
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2008-07-27 19:03:28 +0200
committerLennart Poettering <lennart@poettering.net>2008-07-27 19:03:28 +0200
commit892f583a4893bde8cb49b489b5d89990b8dba291 (patch)
tree65e50c42f027a3b740410f2a37a94affec407d7f /libasyncns
parente907130c34edc88b05cef97806707b28143352a4 (diff)
make sure we only send initialized memory over the socket, to make valgrind shut up
Diffstat (limited to 'libasyncns')
-rw-r--r--libasyncns/asyncns.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libasyncns/asyncns.c b/libasyncns/asyncns.c
index c0995c8..d64ce46 100644
--- a/libasyncns/asyncns.c
+++ b/libasyncns/asyncns.c
@@ -395,6 +395,7 @@ static int send_addrinfo_reply(int out_fd, unsigned id, int ret, struct addrinfo
addrinfo_response_t *resp = data;
assert(out_fd >= 0);
+ memset(data, 0, sizeof(data));
resp->header.type = RESPONSE_ADDRINFO;
resp->header.id = id;
resp->header.length = sizeof(addrinfo_response_t);
@@ -425,6 +426,7 @@ static int send_nameinfo_reply(int out_fd, unsigned id, int ret, const char *hos
sl = serv ? strlen(serv)+1 : 0;
hl = host ? strlen(host)+1 : 0;
+ memset(data, 0, sizeof(data));
resp->header.type = RESPONSE_NAMEINFO;
resp->header.id = id;
resp->header.length = sizeof(nameinfo_response_t) + hl + sl;
@@ -449,6 +451,7 @@ static int send_res_reply(int out_fd, unsigned id, const unsigned char *answer,
assert(out_fd >= 0);
+ memset(data, 0, sizeof(data));
resp->header.type = RESPONSE_RES;
resp->header.id = id;
resp->header.length = sizeof(res_response_t) + (ret < 0 ? 0 : ret);
@@ -757,6 +760,7 @@ void asyncns_free(asyncns_t *asyncns) {
rheader_t req;
assert(asyncns);
+ memset(&req, 0, sizeof(req));
req.type = REQUEST_TERMINATE;
req.length = sizeof(req);
req.id = 0;