mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-24 00:29:58 -05:00
- Fix #99: Memory leak in ub_ctx (event_base will never be freed).
This commit is contained in:
parent
941b324187
commit
7dfbcdf276
3 changed files with 9 additions and 0 deletions
|
|
@ -1,3 +1,6 @@
|
||||||
|
24 October 2019: Wouter
|
||||||
|
- Fix #99: Memory leak in ub_ctx (event_base will never be freed).
|
||||||
|
|
||||||
23 October 2019: George
|
23 October 2019: George
|
||||||
- Add new configure option `--enable-fully-static` to enable full static
|
- Add new configure option `--enable-fully-static` to enable full static
|
||||||
build if requested; in relation to #91.
|
build if requested; in relation to #91.
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,9 @@ struct ub_ctx {
|
||||||
|
|
||||||
/** event base for event oriented interface */
|
/** event base for event oriented interface */
|
||||||
struct ub_event_base* event_base;
|
struct ub_event_base* event_base;
|
||||||
|
/** true if the event_base is a pluggable base that is malloced
|
||||||
|
* with a user event base inside, if so, clean up the pluggable alloc*/
|
||||||
|
int event_base_malloced;
|
||||||
/** libworker for event based interface */
|
/** libworker for event based interface */
|
||||||
struct libworker* event_worker;
|
struct libworker* event_worker;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -226,6 +226,7 @@ ub_ctx_create_event(struct event_base* eb)
|
||||||
ub_ctx_delete(ctx);
|
ub_ctx_delete(ctx);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
ctx->event_base_malloced = 1;
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -336,6 +337,8 @@ ub_ctx_delete(struct ub_ctx* ctx)
|
||||||
log_file(NULL);
|
log_file(NULL);
|
||||||
ctx_logfile_overridden = 0;
|
ctx_logfile_overridden = 0;
|
||||||
}
|
}
|
||||||
|
if(ctx->event_base_malloced)
|
||||||
|
free(ctx->event_base);
|
||||||
free(ctx);
|
free(ctx);
|
||||||
#ifdef USE_WINSOCK
|
#ifdef USE_WINSOCK
|
||||||
WSACleanup();
|
WSACleanup();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue