s3:registry: don't leak to talloc_stack in regdb_store_keys_internal2()
authorMichael Adam <obnox@samba.org>
Wed, 8 Jul 2009 22:21:46 +0000 (00:21 +0200)
committerMichael Adam <obnox@samba.org>
Wed, 15 Jul 2009 12:01:53 +0000 (14:01 +0200)
and catch one potential talloc failure.

Michael

source3/registry/reg_backend_db.c

index 542f6dc7d0dd5e4420464706cceac7127240d583..6bf98d4c7564004c702e921e5459a8c09141f004 100644 (file)
@@ -623,14 +623,21 @@ static WERROR regdb_store_keys_internal2(struct db_context *db,
        WERROR werr;
 
        if (!key) {
-               return WERR_INVALID_PARAM;
+               werr = WERR_INVALID_PARAM;
+               goto done;
        }
 
        keyname = talloc_strdup(ctx, key);
        if (!keyname) {
-               return WERR_NOMEM;
+               werr = WERR_NOMEM;
+               goto done;
        }
+
        keyname = normalize_reg_path(ctx, keyname);
+       if (!keyname) {
+               werr = WERR_NOMEM;
+               goto done;
+       }
 
        /* allocate some initial memory */