examples: Fix memory leaks in the waiter_test.
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 <errno.h>
#include <stdbool.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
@@ -96,6 +97,7 @@
/* 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 @@
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)