s3:printing: Add NULL check for state_path()
authorAndreas Schneider <asn@samba.org>
Mon, 31 Jul 2017 08:09:52 +0000 (10:09 +0200)
committerJeremy Allison <jra@samba.org>
Sat, 19 Aug 2017 03:33:41 +0000 (05:33 +0200)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Aug 19 05:33:41 CEST 2017 on sn-devel-144

source3/printing/nt_printing.c

index 0a0d3f75c69fb9c8b16df8cde23cae700dae39b9..932d4d76df00e2be8bd6b73f4772a2226d09a85b 100644 (file)
@@ -153,20 +153,37 @@ static bool print_driver_directories_init(void)
        }
 
        driver_path = state_path("DriverStore");
+       if (driver_path == NULL) {
+               talloc_free(mem_ctx);
+               return false;
+       }
+
        ok = directory_create_or_exist(driver_path, 0755);
        if (!ok) {
                DEBUG(1,("failed to create path %s\n", driver_path));
                talloc_free(mem_ctx);
                return false;
        }
+
        driver_path = state_path("DriverStore/FileRepository");
+       if (driver_path == NULL) {
+               talloc_free(mem_ctx);
+               return false;
+       }
+
        ok = directory_create_or_exist(driver_path, 0755);
        if (!ok) {
                DEBUG(1,("failed to create path %s\n", driver_path));
                talloc_free(mem_ctx);
                return false;
        }
+
        driver_path = state_path("DriverStore/Temp");
+       if (driver_path == NULL) {
+               talloc_free(mem_ctx);
+               return false;
+       }
+
        ok = directory_create_or_exist(driver_path, 0755);
        if (!ok) {
                DEBUG(1,("failed to create path %s\n", driver_path));