- Fix for out-of-memory condition in libunbound (thanks Robert Fleischman).

git-svn-id: file:///svn/unbound/trunk@2511 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2011-10-14 07:15:41 +00:00
parent a16c24b4f0
commit 80424bc16e
2 changed files with 11 additions and 6 deletions

View file

@ -1,3 +1,7 @@
14 October 2011: Wouter
- Fix for out-of-memory condition in libunbound (thanks
Robert Fleischman).
13 October 2011: Wouter 13 October 2011: Wouter
- Fix --enable-allsymbols, it depended on link specifics of the - Fix --enable-allsymbols, it depended on link specifics of the
target platform, or fptr_wlist assertion failures could occur. target platform, or fptr_wlist assertion failures could occur.

View file

@ -261,7 +261,12 @@ libworker_dobg(void* arg)
/* setup */ /* setup */
uint32_t m; uint32_t m;
struct libworker* w = (struct libworker*)arg; struct libworker* w = (struct libworker*)arg;
struct ub_ctx* ctx = w->ctx; struct ub_ctx* ctx;
if(!w) {
log_err("libunbound bg worker init failed, nomem");
return NULL;
}
ctx = w->ctx;
log_thread_set(&w->thread_num); log_thread_set(&w->thread_num);
#ifdef THREADS_DISABLED #ifdef THREADS_DISABLED
/* we are forked */ /* we are forked */
@ -270,10 +275,6 @@ libworker_dobg(void* arg)
tube_close_write(ctx->qq_pipe); tube_close_write(ctx->qq_pipe);
tube_close_read(ctx->rr_pipe); tube_close_read(ctx->rr_pipe);
#endif #endif
if(!w) {
log_err("libunbound bg worker init failed, nomem");
return NULL;
}
if(!tube_setup_bg_listen(ctx->qq_pipe, w->base, if(!tube_setup_bg_listen(ctx->qq_pipe, w->base,
libworker_handle_control_cmd, w)) { libworker_handle_control_cmd, w)) {
log_err("libunbound bg worker init failed, no bglisten"); log_err("libunbound bg worker init failed, no bglisten");
@ -310,11 +311,11 @@ int libworker_bg(struct ub_ctx* ctx)
if(ctx->dothread) { if(ctx->dothread) {
lock_basic_unlock(&ctx->cfglock); lock_basic_unlock(&ctx->cfglock);
w = libworker_setup(ctx, 1); w = libworker_setup(ctx, 1);
if(!w) return UB_NOMEM;
w->is_bg_thread = 1; w->is_bg_thread = 1;
#ifdef ENABLE_LOCK_CHECKS #ifdef ENABLE_LOCK_CHECKS
w->thread_num = 1; /* for nicer DEBUG checklocks */ w->thread_num = 1; /* for nicer DEBUG checklocks */
#endif #endif
if(!w) return UB_NOMEM;
ub_thread_create(&ctx->bg_tid, libworker_dobg, w); ub_thread_create(&ctx->bg_tid, libworker_dobg, w);
} else { } else {
lock_basic_unlock(&ctx->cfglock); lock_basic_unlock(&ctx->cfglock);