Commit e7953f51 authored by Geoff Simmons's avatar Geoff Simmons

Fix label object finalization.

Only free elements of the VCL table if it is not NULL, and then
don't forget to free the array.
parent 7250cb28
......@@ -91,9 +91,13 @@ vmod_label__fini(struct vmod_dispatch_label **labelp)
CHECK_OBJ(*labelp, VMOD_DISPATCH_LABEL_MAGIC);
label = *labelp;
*labelp = NULL;
for (unsigned i = 0; i < label->nvcls; i++)
if (vbit_test(label->bitmap, i) && label->vcl[i] != NULL)
VRT_vcl_rel(&dummy_ctx, label->vcl[i]);
if (label->vcl != NULL) {
for (unsigned i = 0; i < label->nvcls; i++)
if (vbit_test(label->bitmap, i)
&& label->vcl[i] != NULL)
VRT_vcl_rel(&dummy_ctx, label->vcl[i]);
free(label->vcl);
}
if (label->bitmap != NULL)
vbit_destroy(label->bitmap);
if (label->vcl_name != NULL)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment