mirror of
https://github.com/emqx/neuron.git
synced 2026-10-24 10:46:39 +08:00
Merge pull request #1637 from hxy7yx/main-1
fix memory leaks when get node state without any nodes
This commit is contained in:
@@ -33,8 +33,12 @@ static inline UT_array *utarray_clone(UT_array *array)
|
||||
result->i = array->i;
|
||||
result->n = array->n;
|
||||
result->icd = array->icd;
|
||||
result->d = (char *) calloc(1, array->n * array->icd.sz);
|
||||
memcpy(result->d, array->d, array->n * array->icd.sz);
|
||||
if (array->n > 0) {
|
||||
result->d = (char *) calloc(1, array->n * array->icd.sz);
|
||||
memcpy(result->d, array->d, array->n * array->icd.sz);
|
||||
} else {
|
||||
result->d = NULL;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user