]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Free WNM allocations cleanly in wnm-fuzzer
authorJouni Malinen <jouni@codeaurora.org>
Fri, 24 May 2019 13:30:19 +0000 (16:30 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 24 May 2019 13:30:19 +0000 (16:30 +0300)
Avoid a memory leak in fuzzer tests by calling wnm_deallocate_memory()
before exiting since this fuzzing wrapper does not use full
wpa_supplicant_cleanup().

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
tests/wnm-fuzzer/wnm-fuzzer.c

index de74b6bf912075ac9c5d0328ab953bf3ae844047..2517b5c8500d73f056dedb29143cac2efd6fabde 100644 (file)
@@ -68,6 +68,12 @@ static int init_wpa(struct arg_ctx *ctx)
 }
 
 
+static void deinit_wpa(struct arg_ctx *ctx)
+{
+       wnm_deallocate_memory(&ctx->wpa_s);
+}
+
+
 int main(int argc, char *argv[])
 {
        struct arg_ctx ctx;
@@ -99,6 +105,7 @@ int main(int argc, char *argv[])
        wpa_printf(MSG_DEBUG, "Starting eloop");
        eloop_run();
        wpa_printf(MSG_DEBUG, "eloop done");
+       deinit_wpa(&ctx);
 
        ret = 0;
 fail: