From 2f9e170f45e128eb6ab6bd97c9c8b40dcd9a97fa Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 4 Dec 2004 09:30:38 +0000 Subject: r4058: added a type safe version of smb_xmalloc() (This used to be commit 1235afa5fe3a396cd7a180cbc500834a30fbaa80) --- source4/param/loadparm.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'source4/param') diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c index 334ec982e0..035ac3422a 100644 --- a/source4/param/loadparm.c +++ b/source4/param/loadparm.c @@ -1576,8 +1576,7 @@ static int add_a_service(const service *pservice, const char *name) } else { ServicePtrs = tsp; - ServicePtrs[iNumServices] = - (service *) malloc(sizeof(service)); + ServicePtrs[iNumServices] = malloc_p(service); } if (!ServicePtrs[iNumServices]) { DEBUG(0,("add_a_service: out of memory!\n")); @@ -1871,7 +1870,7 @@ static void copy_service(service * pserviceDest, service * pserviceSource, BOOL pdata = pdata->next; } if (not_added) { - paramo = smb_xmalloc(sizeof(*paramo)); + paramo = smb_xmalloc_p(struct param_opt); paramo->key = strdup(data->key); paramo->value = strdup(data->value); DLIST_ADD(pserviceDest->param_opt, paramo); @@ -1940,7 +1939,7 @@ static void add_to_file_list(const char *fname, const char *subfname) } if (!f) { - f = (struct file_lists *)malloc(sizeof(file_lists[0])); + f = malloc_p(struct file_lists); if (!f) return; f->next = file_lists; @@ -2247,7 +2246,7 @@ static BOOL lp_do_parameter_parametric(int snum, const char *pszParmName, const } } - paramo = smb_xmalloc(sizeof(*paramo)); + paramo = smb_xmalloc_p(struct param_opt); paramo->key = strdup(name); paramo->value = strdup(pszParmValue); paramo->flags = flags; -- cgit