]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
pool: Produce error if we fail linking talloc ctxs
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 27 Aug 2020 20:15:56 +0000 (15:15 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 27 Aug 2020 20:16:11 +0000 (15:16 -0500)
src/lib/server/pool.c
src/lib/util/talloc.c

index 31f27399487d82628ff645ccccc0d1f2d7f5bf9b..b8eb92d1a2cceee5b05253a501547adc9769d5cd 100644 (file)
@@ -955,7 +955,7 @@ fr_pool_t *fr_pool_init(TALLOC_CTX *ctx,
         *      as its parent.
         */
        if (talloc_link_ctx(ctx, pool) < 0) {
-               ERROR("%s: Failed linking pool ctx", __FUNCTION__);
+               PERROR("%s: Failed linking pool ctx", __FUNCTION__);
                talloc_free(pool);
 
                return NULL;
index faaae2ed5612dbca397b713ef77437be9d573cf8..dab1a2b8abf4420548158e8b0a920cada3aa4b04 100644 (file)
@@ -91,10 +91,17 @@ fr_talloc_destructor_t *talloc_destructor_add(TALLOC_CTX *fire_ctx, TALLOC_CTX *
 {
        fr_talloc_destructor_t *d;
 
-       if (!fire_ctx) return NULL;
+       if (!fire_ctx) {
+               fr_strerror_printf("No firing ctx provided when setting destructor");
+               return NULL;
+       }
 
        d = talloc(fire_ctx, fr_talloc_destructor_t);
-       if (!d) return NULL;
+       if (!d) {
+       oom:
+               fr_strerror_printf("Out of Memory");
+               return NULL;
+       }
 
        d->fire = fire_ctx;
        d->func = func;
@@ -106,7 +113,7 @@ fr_talloc_destructor_t *talloc_destructor_add(TALLOC_CTX *fire_ctx, TALLOC_CTX *
                ds = talloc(disarm_ctx, fr_talloc_destructor_disarm_t);
                if (!ds) {
                        talloc_free(d);
-                       return NULL;
+                       goto oom;
                }
                ds->d = d;
                d->ds = ds;