Skip to content

Commit

Permalink
Merge pull request #2381 from hxy7yx/v2.11-fix
Browse files Browse the repository at this point in the history
[v2.11]fix(ptr): memory leak
  • Loading branch information
fengzeroz authored Feb 14, 2025
2 parents e9fd98a + 0dd3c9c commit fefc6ad
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/adapter/driver/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,13 @@ void neu_driver_cache_update_change(neu_driver_cache_t *cache,
}
}

if (elem->value.type == NEU_TYPE_PTR) {
if (elem->value.value.ptr.ptr != NULL) {
free(elem->value.value.ptr.ptr);
elem->value.value.ptr.ptr = NULL;
}
}

if (elem->value.type == NEU_TYPE_ARRAY_STRING) {
for (int i = 0; i < elem->value.value.strs.length; i++) {
free(elem->value.value.strs.strs[i]);
Expand Down

0 comments on commit fefc6ad

Please sign in to comment.