Commit eb92b5f1 authored by nullable.type's avatar nullable.type

Avoid memory leaks if duplicate options are passed.

parent c5ba6016
...@@ -4976,6 +4976,7 @@ struct mg_context *mg_start(mg_callback_t user_callback, void *user_data, ...@@ -4976,6 +4976,7 @@ struct mg_context *mg_start(mg_callback_t user_callback, void *user_data,
} }
if (ctx->config[i] != NULL) { if (ctx->config[i] != NULL) {
cry(fc(ctx), "warning: %s: duplicate option", name); cry(fc(ctx), "warning: %s: duplicate option", name);
free(ctx->config[i]);
} }
ctx->config[i] = mg_strdup(value); ctx->config[i] = mg_strdup(value);
DEBUG_TRACE(("[%s] -> [%s]", name, value)); DEBUG_TRACE(("[%s] -> [%s]", name, value));
......
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