summaryrefslogtreecommitdiff
path: root/src/tools/oping/oping_client.c
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-08-04 21:27:45 +0200
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-08-04 21:27:45 +0200
commit00761652fb55e16227508457da4bda82b19ef193 (patch)
tree5fd4782c2bf701b76fcd7d7a1f15a87a37938de5 /src/tools/oping/oping_client.c
parent4ca72a0c670082f087529257f620614c7d94c1c9 (diff)
downloadouroboros-00761652fb55e16227508457da4bda82b19ef193.tar.gz
ouroboros-00761652fb55e16227508457da4bda82b19ef193.zip
tools: oping: Fix client cleanup
Diffstat (limited to 'src/tools/oping/oping_client.c')
-rw-r--r--src/tools/oping/oping_client.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/tools/oping/oping_client.c b/src/tools/oping/oping_client.c
index 7693ce41..b47eee6c 100644
--- a/src/tools/oping/oping_client.c
+++ b/src/tools/oping/oping_client.c
@@ -132,12 +132,15 @@ void * writer(void * o)
printf("Pinging %s with %d bytes of data:\n\n",
client.s_apn, client.size);
+ pthread_cleanup_push((void (*) (void *)) free, buf);
+
while (client.sent < client.count) {
nanosleep(&wait, NULL);
msg->id = htonl(client.sent);
if (flow_write(*fdp, buf, client.size) == -1) {
printf("Failed to send SDU.\n");
flow_dealloc(*fdp);
+ free(buf);
return (void *) -1;
}
@@ -148,6 +151,8 @@ void * writer(void * o)
pthread_mutex_unlock(&client.lock);
}
+ pthread_cleanup_pop(true);
+
return (void *) 0;
}