diff options
author | dimitri staessens <[email protected]> | 2016-08-04 21:27:45 +0200 |
---|---|---|
committer | dimitri staessens <[email protected]> | 2016-08-04 21:27:45 +0200 |
commit | 00761652fb55e16227508457da4bda82b19ef193 (patch) | |
tree | 5fd4782c2bf701b76fcd7d7a1f15a87a37938de5 /src/tools/oping | |
parent | 4ca72a0c670082f087529257f620614c7d94c1c9 (diff) | |
download | ouroboros-00761652fb55e16227508457da4bda82b19ef193.tar.gz ouroboros-00761652fb55e16227508457da4bda82b19ef193.zip |
tools: oping: Fix client cleanup
Diffstat (limited to 'src/tools/oping')
-rw-r--r-- | src/tools/oping/oping_client.c | 5 |
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; } |