]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
ordering for alloc checks.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 31 Jan 2008 14:45:10 +0000 (14:45 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 31 Jan 2008 14:45:10 +0000 (14:45 +0000)
git-svn-id: file:///svn/unbound/trunk@914 be551aaa-1e26-0410-a405-d3ace91eadb9

libunbound/unbound.c

index 9fd8326fe3f12a7866beb7e4cab0d721b053af5e..a4eb88bc3f0e5bf739a093ec2792e63695de202c 100644 (file)
 struct ub_val_ctx* 
 ub_val_ctx_create()
 {
-       struct ub_val_ctx* ctx = (struct ub_val_ctx*)calloc(1, sizeof(*ctx));
+       struct ub_val_ctx* ctx;
        unsigned int seed;
+       log_init(NULL, 0, NULL); /* logs to stderr */
+       log_ident_set("libunbound");
+       verbosity = 0; /* errors only */
+       checklock_start();
+       ctx = (struct ub_val_ctx*)calloc(1, sizeof(*ctx));
        if(!ctx) {
                errno = ENOMEM;
                return NULL;
        }
-       checklock_start();
-       log_ident_set("libunbound");
-       verbosity = 0; /* errors only */
-       log_init(NULL, 0, NULL); /* logs to stderr */
        alloc_init(&ctx->superalloc, NULL, 0);
        seed = (unsigned int)time(NULL) ^ (unsigned int)getpid();
        if(!(ctx->seed_rnd = ub_initstate(seed, NULL))) {