Fix coverity #740. Resource leak in error paths. We should
authorJeremy Allison <jra@samba.org>
Sat, 20 Jun 2009 00:20:00 +0000 (17:20 -0700)
committerJeremy Allison <jra@samba.org>
Sat, 20 Jun 2009 00:20:00 +0000 (17:20 -0700)
always return queue here as the caller will free.
Jeremy.

source3/printing/print_cups.c

index 18f42138c910df95878af8a52d2a7626a351f906..7d8248e428596ecac31edc0b55c71bba0c23d21f 100644 (file)
@@ -1342,14 +1342,12 @@ static int cups_queue_get(const char *sharename,
        if ((response = cupsDoRequest(http, request, "/")) == NULL) {
                DEBUG(0,("Unable to get printer status for %s - %s\n", printername,
                         ippErrorString(cupsLastError())));
-               *q = queue;
                goto out;
        }
 
        if (response->request.status.status_code >= IPP_OK_CONFLICT) {
                DEBUG(0,("Unable to get printer status for %s - %s\n", printername,
                         ippErrorString(response->request.status.status_code)));
-               *q = queue;
                goto out;
        }
 
@@ -1377,13 +1375,14 @@ static int cups_queue_get(const char *sharename,
                fstrcpy(status->message, msg);
        }
 
+ out:
+
        /*
         * Return the job queue...
        */
 
        *q = queue;
 
- out:
        if (response)
                ippDelete(response);