This patch fixes the following memory leak for resv-report command:-
==7705==
==7705== HEAP SUMMARY:
==7705== in use at exit: 4,096 bytes in 1 blocks
==7705== total heap usage: 31 allocs, 30 frees, 7,941 bytes allocated
==7705==
==7705== LEAK SUMMARY:
==7705== definitely lost: 4,096 bytes in 1 blocks
==7705== indirectly lost: 0 bytes in 0 blocks
==7705== possibly lost: 0 bytes in 0 blocks
==7705== still reachable: 0 bytes in 0 blocks
==7705== suppressed: 0 bytes in 0 blocks
Fix:-
==8253==
==8253== HEAP SUMMARY:
==8253== in use at exit: 0 bytes in 0 blocks
==8253== total heap usage: 31 allocs, 31 frees, 7,941 bytes allocated
==8253==
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@hgst.com>
json_print_object(root, NULL);
printf("\n");
+ json_free_object(root);
}
void json_fw_log(struct nvme_firmware_log_page *fw_log, const char *devname)
show_nvme_resv_report(status);
}
}
+ free(status);
return err;
}