possible memory leak in rpcclient

LI,YING (HP-Cupertino,ex1) ying_li2 at hp.com
Thu Apr 17 01:33:06 GMT 2003


Hello,
It seems  for me to find a possible memory leak for rpcclient in Samba 
code. The patch is attached, Could you have a look and verify whether 
it is correct? 
Thanks.
-Ying

diff -C3 samba-2.2.8a/source/libsmb/cli_pipe_util.c  
         samba-2.2.8a_patch/source/libsmb/cli_pipe_util.c

*** samba-2.2.8a/source/libsmb/cli_pipe_util.c      Fri Mar 14 13:34:47 2003
--- samba-2.2.8a_patch/source/libsmb/cli_pipe_util.c      Wed Apr 16 18:17
:32 2003
***************
*** 50,55 ****
--- 50,56 ----
        /* Establish a SMB connection */

        if (!resolve_srv_name(system_name, dest_host, &dest_ip)) {
+               cli_shutdown(cli);
                return NULL;
        }

***************
*** 58,63 ****
--- 59,65 ----

        if (!cli_establish_connection(cli, dest_host, &dest_ip, &calling,
                                      &called, "IPC$", "IPC", False, True))
{
+               cli_shutdown(cli);
                return NULL;
        }

*** samba-2.2.8a/source/rpcclient/samsync.c Tue Dec 10 06:58:17 2002
--- samba-2.2.8a_patch/source/rpcclient/samsync.c Wed Apr 16 18:19:34 2003
***************
*** 192,197 ****
--- 192,198 ----
          if (!get_dc_list(True, lp_workgroup(), &dest_ip, &count)) {
                  DEBUG(0, ("Cannot find domain controller for domain %s\n",
                            lp_workgroup()));
+                 cli_shutdown(cli);
                  return NULL;
          }

***************
*** 199,204 ****
--- 200,206 ----
                               dest_host)) {
                  DEBUG(0, ("Could not lookup up PDC name for domain %s\n",
                            lp_workgroup()));
+                 cli_shutdown(cli);
                  return NULL;
          }

***************
*** 212,217 ****
--- 214,220 ----

        if (!cli_establish_connection(cli, dest_host, dest_ip, &calling,
                                      &called, "IPC$", "IPC", False, True))
{
+               cli_shutdown(cli);
                return NULL;
        }



More information about the samba-technical mailing list