diff options
| author | zhuzhenjun <[email protected]> | 2023-10-25 10:39:32 +0800 |
|---|---|---|
| committer | zhuzhenjun <[email protected]> | 2023-10-25 10:41:32 +0800 |
| commit | c9247d713da668ed1bd2d332849dd9409330c0e3 (patch) | |
| tree | 780744dd2250f31b82ef5c1ad5e673064b1930af /src/osfp.c | |
| parent | 8832411f2957ae8a37d3d6fbd4b3017247246fbd (diff) | |
code: fix memory leakv1.3.3
Diffstat (limited to 'src/osfp.c')
| -rw-r--r-- | src/osfp.c | 11 |
1 files changed, 2 insertions, 9 deletions
@@ -97,11 +97,7 @@ char *osfp_result_score_detail_export(struct osfp_result *result) osfp_profile_get_cycle(c1); if (result == NULL) { - return NULL; - } - - if (result->json_str != NULL) { - return result->json_str; + goto exit; } root = cJSON_CreateObject(); @@ -141,7 +137,7 @@ char *osfp_result_score_detail_export(struct osfp_result *result) goto exit; } - result->json_str = result_str; + cJSON_Delete(root); osfp_profile_get_cycle(c2); osfp_profile_counter_update(&osfp_profile_result_export, c2 - c1); @@ -157,9 +153,6 @@ exit: void osfp_result_free(struct osfp_result *result) { if (result) { - if (result->json_str) { - free(result->json_str); - } free(result); } } |
