]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Fix a memleak in construct_printer_info_7()
authorVolker Lendecke <vl@samba.org>
Tue, 6 May 2008 13:06:12 +0000 (15:06 +0200)
committerVolker Lendecke <vl@samba.org>
Tue, 6 May 2008 13:08:30 +0000 (15:08 +0200)
Also fix a "ignoring asprintf result" warning
(This used to be commit 64d21f39636019d6a17f84efc6fb9e61e67a235e)

source3/rpc_server/srv_spoolss_nt.c

index a7b477e17d5e2ba336224eb0213ecfeab7352852..0e98a394265860f90a278dba7a3d6122aa5ef9e0 100644 (file)
@@ -4357,10 +4357,13 @@ static bool construct_printer_info_7(Printer_entry *print_hnd, PRINTER_INFO_7 *p
        struct GUID guid;
 
        if (is_printer_published(print_hnd, snum, &guid)) {
-               asprintf(&guid_str, "{%s}",
-                        smb_uuid_string(talloc_tos(), guid));
+               if (asprintf(&guid_str, "{%s}",
+                            smb_uuid_string(talloc_tos(), guid)) == -1) {
+                       return false;
+               }
                strupper_m(guid_str);
                init_unistr(&printer->guid, guid_str);
+               SAFE_FREE(guid_str);
                printer->action = SPOOL_DS_PUBLISH;
        } else {
                init_unistr(&printer->guid, "");