summaryrefslogtreecommitdiff
path: root/source3/param
diff options
context:
space:
mode:
Diffstat (limited to 'source3/param')
-rw-r--r--source3/param/loadparm.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index f65682fbed..31402cc0a2 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -9620,17 +9620,11 @@ struct share_params *get_share_params(TALLOC_CTX *mem_ctx,
const char *sharename)
{
struct share_params *result;
- char *sname;
+ char *sname = NULL;
int snum;
- if (!(sname = SMB_STRDUP(sharename))) {
- return NULL;
- }
-
- snum = find_service(sname);
- SAFE_FREE(sname);
-
- if (snum < 0) {
+ snum = find_service(mem_ctx, sharename, &sname);
+ if (snum < 0 || sname == NULL) {
return NULL;
}