Fix use-after-free

This commit is contained in:
Simon Kelley
2013-02-05 14:51:14 +00:00
parent 04a0612e8a
commit 4ead40cf67

View File

@@ -620,10 +620,10 @@ void dhcp_construct_contexts(time_t now)
if (context->flags & CONTEXT_GC) if (context->flags & CONTEXT_GC)
{ {
*up = context->next; *up = context->next;
free(context);
param.newone = 1; /* include deletion */ param.newone = 1; /* include deletion */
if (context->flags & CONTEXT_RA_NAME) if (context->flags & CONTEXT_RA_NAME)
param.newname = 1; param.newname = 1;
free(context);
} }
else else
up = &context->next; up = &context->next;