summaryrefslogtreecommitdiff
path: root/source3/smbwrapper/smbw_cache.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-12-16 21:12:29 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:53:39 -0500
commit54fdd5c7dc98e9039d94bc6b45ee31cb1d363eac (patch)
tree3e777cddfa2c8a2da0540ff010d02d63c9894631 /source3/smbwrapper/smbw_cache.c
parent46f0e330f1e455e3338a7e7a3b7a287df752fe1a (diff)
downloadsamba-54fdd5c7dc98e9039d94bc6b45ee31cb1d363eac.tar.gz
samba-54fdd5c7dc98e9039d94bc6b45ee31cb1d363eac.tar.bz2
samba-54fdd5c7dc98e9039d94bc6b45ee31cb1d363eac.zip
r4236: More *alloc fixes.
Jeremy. (This used to be commit 6b25a6e088390d33314ca69c8f17c869cec3904b)
Diffstat (limited to 'source3/smbwrapper/smbw_cache.c')
-rw-r--r--source3/smbwrapper/smbw_cache.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/source3/smbwrapper/smbw_cache.c b/source3/smbwrapper/smbw_cache.c
index fcb0eda805..cfa8ab1f76 100644
--- a/source3/smbwrapper/smbw_cache.c
+++ b/source3/smbwrapper/smbw_cache.c
@@ -65,14 +65,14 @@ static void add_cached_names(const char *name, uint32 stype,
struct name_list **name_list = (struct name_list **)state;
struct name_list *new_name;
- new_name = (struct name_list *)malloc(sizeof(struct name_list));
+ new_name = SMB_MALLOC_P(struct name_list);
if (!new_name) return;
ZERO_STRUCTP(new_name);
- new_name->name = strdup(name);
+ new_name->name = SMB_STRDUP(name);
new_name->stype = stype;
- new_name->comment = strdup(comment);
+ new_name->comment = SMB_STRDUP(comment);
DLIST_ADD(*name_list, new_name);
}
@@ -117,8 +117,7 @@ BOOL smbw_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
/* No names cached for this workgroup */
if (names == NULL) {
- new_names = (struct cached_names *)
- malloc(sizeof(struct cached_names));
+ new_names = SMB_MALLOC_P(struct cached_names);
ZERO_STRUCTP(new_names);
DLIST_ADD(cached_names, new_names);
@@ -139,7 +138,7 @@ BOOL smbw_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
new_names->cache_timeout = now;
new_names->result = result;
- new_names->key = strdup(key);
+ new_names->key = SMB_STRDUP(key);
names = new_names;
}
@@ -173,8 +172,7 @@ int smbw_RNetShareEnum(struct cli_state *cli,
/* No names cached for this server */
if (names == NULL) {
- new_names = (struct cached_names *)
- malloc(sizeof(struct cached_names));
+ new_names = SMB_MALLOC_P(struct cached_names);
ZERO_STRUCTP(new_names);
DLIST_ADD(cached_names, new_names);
@@ -193,7 +191,7 @@ int smbw_RNetShareEnum(struct cli_state *cli,
&new_names->name_list);
new_names->cache_timeout = now;
- new_names->key = strdup(key);
+ new_names->key = SMB_STRDUP(key);
names = new_names;
}