mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-02-18 18:25:10 -05:00
Fixing use-after-free issue which raised up while fixing issue #99
This commit is contained in:
parent
1d45b4a1e0
commit
d8d3036ec7
1 changed files with 10 additions and 3 deletions
|
|
@ -217,15 +217,22 @@ ub_ctx_create_event(struct event_base* eb)
|
|||
ctx->created_bg = 0;
|
||||
ctx->dothread = 1; /* the processing is in the same process,
|
||||
makes ub_cancel and ub_ctx_delete do the right thing */
|
||||
ctx->event_base = ub_libevent_event_base(eb);
|
||||
if(eb) {
|
||||
ctx->event_base = ub_libevent_event_base(eb);
|
||||
ctx->event_base_malloced = 1;
|
||||
} else {
|
||||
ctx->event_base = ub_libevent_event_base(NULL);
|
||||
ctx->event_base_malloced = 0;
|
||||
}
|
||||
|
||||
if (!ctx->event_base) {
|
||||
ub_ctx_delete(ctx);
|
||||
return NULL;
|
||||
}
|
||||
ctx->event_base_malloced = 1;
|
||||
|
||||
return ctx;
|
||||
}
|
||||
|
||||
|
||||
/** delete q */
|
||||
static void
|
||||
delq(rbnode_type* n, void* ATTR_UNUSED(arg))
|
||||
|
|
|
|||
Loading…
Reference in a new issue