If we remove the last item of bucket, there should still be
one final entry in the __weights__ field of __weight_set__.
Free the corresponding memory before we __null__ the pointer.
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
weight_set->weights = (__u32*)realloc(weight_set->weights,
new_size * sizeof(__u32));
} else {
+ free(weight_set->weights);
weight_set->weights = NULL;
}
weight_set->size = new_size;
if (new_size) {
arg->ids = (__s32 *)realloc(arg->ids, new_size * sizeof(__s32));
} else {
+ free(arg->ids);
arg->ids = NULL;
}
arg->ids_size = new_size;