spdk_top: fix memory leaks upon exiting application
Fixes momory leak in spdk_top upon exiting due to not freeing json response. Fixes #2129 Change-Id: Ia0fee94e2c12dceda921cc540f6e3466ef4f6905 Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9313 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
parent
a4b7f87b61
commit
38ea8d54f3
@ -545,6 +545,7 @@ rpc_send_req(char *rpc_name, struct spdk_jsonrpc_client_response **resp)
|
||||
|
||||
/* Check for error response */
|
||||
if (json_resp->error != NULL) {
|
||||
spdk_jsonrpc_client_free_response(json_resp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -2733,8 +2734,6 @@ wait_init(pthread_t *data_thread)
|
||||
print_in_middle(stdscr, FIRST_DATA_ROW, 1, max_col, uninit_log, COLOR_PAIR(5));
|
||||
rc = rpc_send_req("framework_wait_init", &json_resp);
|
||||
if (rc) {
|
||||
spdk_jsonrpc_client_free_response(json_resp);
|
||||
|
||||
while (1) {
|
||||
print_in_middle(stdscr, FIRST_DATA_ROW, 1, max_col, uninit_error, COLOR_PAIR(8));
|
||||
c = getch();
|
||||
@ -2762,9 +2761,12 @@ wait_init(pthread_t *data_thread)
|
||||
}
|
||||
|
||||
if (rpc_decode_tick_rate(json_resp->result, &tick_rate)) {
|
||||
spdk_jsonrpc_client_free_response(json_resp);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
spdk_jsonrpc_client_free_response(json_resp);
|
||||
|
||||
g_tick_rate = tick_rate;
|
||||
|
||||
/* This is to get first batch of data for display functions.
|
||||
|
Loading…
Reference in New Issue
Block a user