From 8fd02fa2d6bdedbda1657a15f602bb4384367251 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 31 May 2012 15:06:58 -0700 Subject: Forward port of Richard Sharpe's fix for bug #8970 - Possible memory leaks in the samba master process. --- source3/printing/load.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source3/printing/load.c') diff --git a/source3/printing/load.c b/source3/printing/load.c index 161d71103c..af4dcc7a2b 100644 --- a/source3/printing/load.c +++ b/source3/printing/load.c @@ -31,6 +31,7 @@ static void add_auto_printers(void) int pnum = lp_servicenumber(PRINTERS_NAME); char *str; char *saveptr; + char *auto_serv = NULL; if (pnum < 0) if (process_registry_service(PRINTERS_NAME)) @@ -39,8 +40,12 @@ static void add_auto_printers(void) if (pnum < 0) return; - if ((str = SMB_STRDUP(lp_auto_services())) == NULL) + auto_serv = lp_auto_services(); + str = SMB_STRDUP(auto_serv); + TALLOC_FREE(auto_serv); + if (str == NULL) { return; + } for (p = strtok_r(str, LIST_SEP, &saveptr); p; p = strtok_r(NULL, LIST_SEP, &saveptr)) { -- cgit