From 02dd1f7f4c4f6e1f91bd651ccdde9b2bb3fcef81 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 16 Dec 2007 12:58:07 +0100 Subject: Make smb_np_struct talloc'ed Convert "name" from string to a talloc'ed char * (This used to be commit e82069f921b3a22295db91e092c22c459ccd7215) --- source3/rpc_server/srv_pipe_hnd.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'source3/rpc_server') 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; } -- cgit