s4:registry - "patchfile" - check if strings could be allocated
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Mon, 22 Mar 2010 12:39:40 +0000 (13:39 +0100)
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Mon, 22 Mar 2010 12:39:40 +0000 (13:39 +0100)
source4/lib/registry/patchfile.c

index 9a4c9a6fb76cb742c81ddb4ba9750ea4125ef5eb..2932910ea0f0c18c137488741e27c3a5196ab477 100644 (file)
@@ -95,6 +95,11 @@ WERROR reg_generate_diff_key(struct registry_key *oldkey,
                /* if "error2" is going to be "WERR_BADFILE", then newkey */
                /* didn't have such a subkey and therefore add a del diff */
                tmppath = talloc_asprintf(mem_ctx, "%s\\%s", path, keyname1);
+               if (tmppath == NULL) {
+                       DEBUG(0, ("Out of memory\n"));
+                       talloc_free(mem_ctx);
+                       return WERR_NOMEM;
+               }
                if (!W_ERROR_IS_OK(error2))
                        callbacks->del_key(callback_data, tmppath);
 
@@ -156,6 +161,11 @@ WERROR reg_generate_diff_key(struct registry_key *oldkey,
 
                /* oldkey didn't have such a subkey, add a add diff */
                tmppath = talloc_asprintf(mem_ctx, "%s\\%s", path, keyname1);
+               if (tmppath == NULL) {
+                       DEBUG(0, ("Out of memory\n"));
+                       talloc_free(mem_ctx);
+                       return WERR_NOMEM;
+               }
                callbacks->add_key(callback_data, tmppath);
 
                /* perform here also the recursive invocation */