summaryrefslogtreecommitdiff
path: root/source3/rpc_server/srv_pipe_hnd.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2007-12-16 12:58:07 +0100
committerVolker Lendecke <vl@samba.org>2007-12-16 12:59:21 +0100
commit02dd1f7f4c4f6e1f91bd651ccdde9b2bb3fcef81 (patch)
tree870652b50a7eeefb61f6617649b379b213e43b54 /source3/rpc_server/srv_pipe_hnd.c
parenta9b6deaa05942e4ffbfa3ee32a6ab65b866cc66d (diff)
downloadsamba-02dd1f7f4c4f6e1f91bd651ccdde9b2bb3fcef81.tar.gz
samba-02dd1f7f4c4f6e1f91bd651ccdde9b2bb3fcef81.tar.bz2
samba-02dd1f7f4c4f6e1f91bd651ccdde9b2bb3fcef81.zip
Make smb_np_struct talloc'ed
Convert "name" from string to a talloc'ed char * (This used to be commit e82069f921b3a22295db91e092c22c459ccd7215)
Diffstat (limited to 'source3/rpc_server/srv_pipe_hnd.c')
-rw-r--r--source3/rpc_server/srv_pipe_hnd.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c
index 969c9ecda3..95ce496ba6 100644
--- a/source3/rpc_server/srv_pipe_hnd.c
+++ b/source3/rpc_server/srv_pipe_hnd.c
@@ -195,14 +195,21 @@ smb_np_struct *open_rpc_pipe_p(const char *pipe_name,
DEBUG(5,("open_rpc_pipe_p: name %s pnum=%x\n", p->name, p->pnum));
}
- p = SMB_MALLOC_P(smb_np_struct);
+ p = talloc(NULL, smb_np_struct);
if (!p) {
- DEBUG(0,("ERROR! no memory for pipes_struct!\n"));
+ DEBUG(0,("ERROR! no memory for smb_np_struct!\n"));
return NULL;
}
ZERO_STRUCTP(p);
+ p->name = talloc_strdup(p, pipe_name);
+ if (p->name == NULL) {
+ TALLOC_FREE(p);
+ DEBUG(0,("ERROR! no memory for pipe name!\n"));
+ return NULL;
+ }
+
/* add a dso mechanism instead of this, here */
p->namedpipe_create = make_internal_rpc_pipe_p;
@@ -241,9 +248,7 @@ smb_np_struct *open_rpc_pipe_p(const char *pipe_name,
p->vuid = vuid;
p->max_trans_reply = 0;
-
- fstrcpy(p->name, pipe_name);
-
+
DEBUG(4,("Opened pipe %s with handle %x (pipes_open=%d)\n",
pipe_name, i, pipes_open));
@@ -1163,9 +1168,7 @@ bool close_rpc_pipe_hnd(smb_np_struct *p)
"pipe from open db.\n", p->name));
}
- ZERO_STRUCTP(p);
-
- SAFE_FREE(p);
+ TALLOC_FREE(p);
return True;
}