summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Disseldorp <ddiss@suse.de>2011-03-09 15:18:22 +0100
committerAndreas Schneider <asn@cryptomilk.org>2011-03-16 16:37:58 +0100
commit97cdf15f0905039ca76a40093c712db8b0984caa (patch)
tree59e4e337f88908bda0539cd9bf23a41b7aa3588e
parent52845c1054941e697143940b94a0792f4d4e07c5 (diff)
downloadsamba-97cdf15f0905039ca76a40093c712db8b0984caa.tar.gz
samba-97cdf15f0905039ca76a40093c712db8b0984caa.tar.bz2
samba-97cdf15f0905039ca76a40093c712db8b0984caa.zip
s3-printing: fix memory leak in print_cups.c
As found by valgrind, tmp_pcap_cache is not freed following printer list tdb update. Signed-off-by: Andreas Schneider <asn@samba.org> Autobuild-User: Andreas Schneider <asn@cryptomilk.org> Autobuild-Date: Wed Mar 16 16:37:58 CET 2011 on sn-devel-104
-rw-r--r--source3/printing/print_cups.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/source3/printing/print_cups.c b/source3/printing/print_cups.c
index b151511b21..e3b08b7d2e 100644
--- a/source3/printing/print_cups.c
+++ b/source3/printing/print_cups.c
@@ -481,28 +481,21 @@ static void cups_async_callback(struct event_context *event_ctx,
pcap_data.printers[i].info);
if (!ret_ok) {
DEBUG(0, ("failed to add to tmp pcap cache\n"));
- break;
+ goto err_out;
}
}
+ /* replace the system-wide pcap cache with a (possibly empty) new one */
+ ret_ok = pcap_cache_replace(tmp_pcap_cache);
if (!ret_ok) {
- DEBUG(0, ("failed to read a new printer list\n"));
- pcap_cache_destroy_specific(&tmp_pcap_cache);
- } else {
- /*
- * replace the system-wide pcap cache with a (possibly empty)
- * new one.
- */
- ret_ok = pcap_cache_replace(tmp_pcap_cache);
- if (!ret_ok) {
- DEBUG(0, ("failed to replace pcap cache\n"));
- } else if (cb_args->post_cache_fill_fn != NULL) {
- /* Caller requested post cache fill callback */
- cb_args->post_cache_fill_fn(cb_args->event_ctx,
- cb_args->msg_ctx);
- }
+ DEBUG(0, ("failed to replace pcap cache\n"));
+ } else if (cb_args->post_cache_fill_fn != NULL) {
+ /* Caller requested post cache fill callback */
+ cb_args->post_cache_fill_fn(cb_args->event_ctx,
+ cb_args->msg_ctx);
}
err_out:
+ pcap_cache_destroy_specific(&tmp_pcap_cache);
TALLOC_FREE(frame);
close(cb_args->pipe_fd);
TALLOC_FREE(cb_args);