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.
This commit is contained in:
Lioncash 2018-08-11 21:44:37 -04:00
parent ab6fe349da
commit 2098e42ebe

1
npdm.c
View file

@ -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);
}