summaryrefslogtreecommitdiff
path: root/source3/printing
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2001-08-08 16:54:16 +0000
committerSimo Sorce <idra@samba.org>2001-08-08 16:54:16 +0000
commit2f844bf447a98b802daa4b8d552ea4530e7f6108 (patch)
tree7beda0672e5fcc15125a7643d4d5fdef6f02b49e /source3/printing
parent0897979a8b0976e03a84ccaf6a70cbaa62bbd195 (diff)
downloadsamba-2f844bf447a98b802daa4b8d552ea4530e7f6108.tar.gz
samba-2f844bf447a98b802daa4b8d552ea4530e7f6108.tar.bz2
samba-2f844bf447a98b802daa4b8d552ea4530e7f6108.zip
Change all realloc() statements to Realloc() (ecxept for tdb.c)
changed some code to exploit the fact that Realloc(NULL, size) == malloc(size) fixed some possible mem leaks, or seg faults. thanks to andreas moroder (mallocs not checked in client/client.c, client/smbumount.c) (This used to be commit 7f33c01688b825ab2fa9bbb2730bff4f2fa352be)
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/print_cups.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/source3/printing/print_cups.c b/source3/printing/print_cups.c
index 6d5a5460cd..0a40e5ec91 100644
--- a/source3/printing/print_cups.c
+++ b/source3/printing/print_cups.c
@@ -819,17 +819,16 @@ cups_queue_get(int snum, print_queue_struct **q, print_status_struct *status)
{
qalloc += 16;
- if (qalloc == 16)
- temp = malloc(sizeof(print_queue_struct) * qalloc);
- else
- temp = realloc(queue, sizeof(print_queue_struct) * qalloc);
+ temp = Realloc(queue, sizeof(print_queue_struct) * qalloc);
if (temp == NULL)
{
+ DEBUG(0,("cups_queue_get: Not enough memory!");
ippDelete(response);
httpClose(http);
- return (qcount);
+ free (queue);
+ return (0);
}
queue = temp;
@@ -960,6 +959,7 @@ cups_queue_get(int snum, print_queue_struct **q, print_status_struct *status)
DEBUG(0,("Unable to get printer status for %s - %s\n", PRINTERNAME(snum),
ippErrorString(cupsLastError())));
httpClose(http);
+ *q = queue;
return (qcount);
}
@@ -969,7 +969,7 @@ cups_queue_get(int snum, print_queue_struct **q, print_status_struct *status)
ippErrorString(response->request.status.status_code)));
ippDelete(response);
httpClose(http);
-
+ *q = queue;
return (qcount);
}