s3/utils: check result of talloc_strdup
authorNoel Power <noel.power@suse.com>
Mon, 17 Oct 2022 09:27:31 +0000 (10:27 +0100)
committerJeremy Allison <jra@samba.org>
Mon, 17 Oct 2022 19:49:36 +0000 (19:49 +0000)
follow to commit 4b15d8c2a5c8547b84e7926fed9890b5676b8bc3

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15205

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Oct 17 19:49:37 UTC 2022 on sn-devel-184

source3/utils/testparm.c

index c751c06dcc90c527b1a9d4b146d47c8995cb36b0..e0455b9d7b6b9c5f8781efc4cc8b9137060e19a9 100644 (file)
@@ -844,6 +844,11 @@ static void do_per_share_checks(int s)
 
        if (poptPeekArg(pc)) {
                config_file = talloc_strdup(frame, poptGetArg(pc));
+                if (config_file == NULL) {
+                        DBG_ERR("out of memory\n");
+                        TALLOC_FREE(frame);
+                        exit(1);
+                }
        } else {
                config_file = get_dyn_CONFIGFILE();
        }