r15569: Fix Coverity bug # 287. Jerry, can you check if WERR_NOMEM is a correct error
authorVolker Lendecke <vlendec@samba.org>
Sat, 13 May 2006 17:17:07 +0000 (17:17 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:17:01 +0000 (11:17 -0500)
code here?

Thanks,

Volker

source/printing/nt_printing.c

index b0bac86dadc516ec1336965f81f0202d9d8e9056..79061ebd41623a32ae01d913d06f9f45d616d489 100644 (file)
@@ -3020,8 +3020,19 @@ static WERROR nt_printer_publish_ads(ADS_STRUCT *ads,
 
        /* build the ads mods */
        ctx = talloc_init("nt_printer_publish_ads");
+       if (ctx == NULL) {
+               SAFE_FREE(prt_dn);
+               return WERR_NOMEM;
+       }
+
        mods = ads_init_mods(ctx);
 
+       if (mods == NULL) {
+               SAFE_FREE(prt_dn);
+               talloc_destroy(ctx);
+               return WERR_NOMEM;
+       }
+
        get_local_printer_publishing_data(ctx, &mods, printer->info_2->data);
        ads_mod_str(ctx, &mods, SPOOL_REG_PRINTERNAME, 
                    printer->info_2->sharename);