From 7ac0b320e19a2ae6a65e641698c802a7738e0ab6 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 11 Jun 2013 09:50:43 +0200 Subject: [PATCH] examples: Fix memory leaks in the waiter_test. --- example/chef_wrap/waiter_test_wrap.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/example/chef_wrap/waiter_test_wrap.c b/example/chef_wrap/waiter_test_wrap.c index 1fa930b..1b8ed94 100644 --- a/example/chef_wrap/waiter_test_wrap.c +++ b/example/chef_wrap/waiter_test_wrap.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -96,6 +97,7 @@ static int waiter_process(const char *order, char **dish) /* Check if we received the dish we wanted from the kitchen */ if (strcmp(order, *dish) != 0) { + free(*dish); *dish = NULL; return -2; } @@ -128,6 +130,9 @@ static void test_order_hotdog(void **state) assert_int_equal(rv, 0); /* And actually receive one */ assert_string_equal(dish, "hotdog"); + if (dish != NULL) { + free(dish); + } } static void test_bad_dish(void **state) -- 2.7.4