summaryrefslogtreecommitdiff
path: root/src/osfp.c
diff options
context:
space:
mode:
authorzhuzhenjun <[email protected]>2023-10-25 10:39:32 +0800
committerzhuzhenjun <[email protected]>2023-10-25 10:41:32 +0800
commitc9247d713da668ed1bd2d332849dd9409330c0e3 (patch)
tree780744dd2250f31b82ef5c1ad5e673064b1930af /src/osfp.c
parent8832411f2957ae8a37d3d6fbd4b3017247246fbd (diff)
code: fix memory leakv1.3.3
Diffstat (limited to 'src/osfp.c')
-rw-r--r--src/osfp.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/osfp.c b/src/osfp.c
index 53fa5a5..1a23342 100644
--- a/src/osfp.c
+++ b/src/osfp.c
@@ -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);
}
}