s3:net registry import: untangle nested function calls
authorMichael Adam <obnox@samba.org>
Tue, 26 Jun 2012 11:37:46 +0000 (13:37 +0200)
committerMichael Adam <obnox@samba.org>
Tue, 26 Jun 2012 17:57:19 +0000 (19:57 +0200)
source3/utils/net_registry.c

index 5e0e556c2239de4ee8fe46225a2ea36f4b167eaf..763ed0d918175e0d85a9be9f81e36ffb97b67707 100644 (file)
@@ -1240,6 +1240,7 @@ static int import_with_precheck_action(const char *import_fname,
                .setval_type = REGISTRY_VALUE,
                .data        = &import_ctx
        };
+       struct reg_parse_callback *parse_callback;
        int ret = -1;
        bool precheck_ok;
 
@@ -1248,9 +1249,13 @@ static int import_with_precheck_action(const char *import_fname,
                goto done;
        }
 
-       ret = reg_parse_file(import_fname,
-                            reg_import_adapter(frame, import_callback),
-                            parse_options);
+       parse_callback = reg_import_adapter(frame, import_callback);
+       if (parse_callback == NULL) {
+               d_printf("talloc failed\n");
+               goto done;
+       }
+
+       ret = reg_parse_file(import_fname, parse_callback, parse_options);
 
 done:
        talloc_free(frame);