summaryrefslogtreecommitdiff
path: root/src/tools/oping/oping_client.c
diff options
context:
space:
mode:
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;
}