From 2098e42ebe0cca946497295f278c1f6fc6b7488f Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 11 Aug 2018 21:44:37 -0400 Subject: [PATCH] npdm: Free JSON buffer when done with it in npdm_save() It's the caller's responsibility to free the buffer returned by cJSON, so we do that here to avoid a leak. --- npdm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/npdm.c b/npdm.c index 83748e8..551b893 100644 --- a/npdm.c +++ b/npdm.c @@ -677,6 +677,7 @@ void npdm_save(npdm_t *npdm, hactool_ctx_t *tool_ctx) { fprintf(stderr, "Failed to write JSON file!\n"); exit(EXIT_FAILURE); } + cJSON_free(json); fclose(f_json); }