source3/loadparm: make struct loadparm_service a talloc object.
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 23 Jul 2012 02:50:26 +0000 (12:20 +0930)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 7 Aug 2012 13:20:05 +0000 (23:20 +1000)
This gives us a place to allocate members from.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
source3/param/loadparm.c

index 1cbac61fcc0a66743d0a9561a11bb89415e9bc48..a4d5bfc55181e7cc5e75bf65d00f81ceceaa241a 100644 (file)
@@ -1511,6 +1511,7 @@ static void free_service_byindex(int idx)
        }
 
        free_service(ServicePtrs[idx]);
+       talloc_free_children(ServicePtrs[idx]);
 }
 
 /***************************************************************************
@@ -1551,7 +1552,7 @@ static int add_a_service(const struct loadparm_service *pservice, const char *na
                        return (-1);
                }
                ServicePtrs = tsp;
-               ServicePtrs[iNumServices] = SMB_MALLOC_P(struct loadparm_service);
+               ServicePtrs[iNumServices] = talloc(NULL, struct loadparm_service);
                if (!ServicePtrs[iNumServices]) {
                        DEBUG(0,("add_a_service: out of memory!\n"));
                        return (-1);