[PATCH] tools: Fix error handling in oping write thread

  • From: Dimitri Staessens <dimitri@ouroboros.rocks>
  • To: ouroboros@xxxxxxxxxxxxx
  • Date: Sat, 10 Oct 2020 15:03:17 +0200

The function was returning under a cleanup handler, which is not
allowed. We don't do anything with the return value if the write
thread ends, so just stopping the thread is fine.

Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
---
 src/tools/oping/oping_client.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/tools/oping/oping_client.c b/src/tools/oping/oping_client.c
index 35f49aa..55ef6dc 100644
--- a/src/tools/oping/oping_client.c
+++ b/src/tools/oping/oping_client.c
@@ -177,10 +177,7 @@ void * writer(void * o)
 
                 if (flow_write(*fdp, buf, client.size) < 0) {
                         printf("Failed to send packet.\n");
-                        flow_dealloc(*fdp);
-                        free(buf);
                         stop = true;
-                        return (void *) -1;
                 }
         }
 
-- 
2.28.0


Other related posts:

  • » [PATCH] tools: Fix error handling in oping write thread - Dimitri Staessens