[Olsr-dev] [PATCH v1 077/115] info: write_data: properly clean up an output buffer
Ferry Huberts
(spam-protected)
Wed Dec 2 21:28:50 CET 2015
From: Ferry Huberts <(spam-protected)>
Signed-off-by: Ferry Huberts <(spam-protected)>
---
lib/info/olsrd_info.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/info/olsrd_info.c b/lib/info/olsrd_info.c
index eea370a..b1bf2ae 100644
--- a/lib/info/olsrd_info.c
+++ b/lib/info/olsrd_info.c
@@ -190,8 +190,11 @@ static void write_data(void *foo __attribute__ ((unused))) {
if (result <= 0 || outbuffer.written[i] == outbuffer.size[i]) {
/* close this socket and cleanup*/
close(outbuffer.socket[i]);
+ outbuffer.socket[i] = -1;
free(outbuffer.buffer[i]);
outbuffer.buffer[i] = NULL;
+ outbuffer.size[i] = 0;
+ outbuffer.written[i] = 0;
for (j = i + 1; j < outbuffer.count; j++) {
outbuffer.buffer[j - 1] = outbuffer.buffer[j];
--
2.5.0
More information about the Olsr-dev
mailing list