projects
/
oweals
/
mdnsd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
ccc95c1
)
dns: use alloca instead of malloc to fix memleak in dns_send_answer()
author
Felix Fietkau
<nbd@openwrt.org>
Tue, 3 Jun 2014 21:23:12 +0000
(23:23 +0200)
committer
Felix Fietkau
<nbd@openwrt.org>
Tue, 3 Jun 2014 21:23:12 +0000
(23:23 +0200)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
dns.c
patch
|
blob
|
history
diff --git
a/dns.c
b/dns.c
index 517825be9daba327c4f75c53d9dc8a841e55cf7d..cf8c3d5bc3f93842f83df316858035167b54932d 100644
(file)
--- a/
dns.c
+++ b/
dns.c
@@
-182,10
+182,7
@@
dns_send_answer(struct uloop_fd *u, char *answer)
h.answers = __cpu_to_be16(dns_answer_cnt);
h.flags = __cpu_to_be16(0x8400);
- iov = malloc(sizeof(struct iovec) * ((dns_answer_cnt * 3) + 1));
- if (!iov)
- return;
-
+ iov = alloca(sizeof(struct iovec) * ((dns_answer_cnt * 3) + 1));
iov[0].iov_base = &h;
iov[0].iov_len = sizeof(struct dns_header);