and yet another memory leak - this one in the client
authorAndrew Tridgell <tridge@samba.org>
Tue, 2 May 2000 07:50:33 +0000 (07:50 +0000)
committerAndrew Tridgell <tridge@samba.org>
Tue, 2 May 2000 07:50:33 +0000 (07:50 +0000)
source/client/client.c

index 7431b2704e5baa5dce7443b835866a8155832cde..6449b1335c65751fe8953acc1c21b7db3c21180c 100644 (file)
@@ -1921,6 +1921,7 @@ struct cli_state *do_connect(char *server, char *share)
                DEBUG(0,("session request to %s failed (%s)\n", 
                         called.name, cli_errstr(c)));
                cli_shutdown(c);
+               free(c);
                if ((p=strchr(called.name, '.'))) {
                        *p = 0;
                        goto again;
@@ -1937,6 +1938,7 @@ struct cli_state *do_connect(char *server, char *share)
        if (!cli_negprot(c)) {
                DEBUG(0,("protocol negotiation failed\n"));
                cli_shutdown(c);
+               free(c);
                return NULL;
        }
 
@@ -1955,6 +1957,8 @@ struct cli_state *do_connect(char *server, char *share)
                if (password[0] || !username[0] || 
                    !cli_session_setup(c, "", "", 0, "", 0, workgroup)) { 
                        DEBUG(0,("session setup failed: %s\n", cli_errstr(c)));
+                       cli_shutdown(c);
+                       free(c);
                        return NULL;
                }
                DEBUG(0,("Anonymous login successful\n"));
@@ -1978,6 +1982,7 @@ struct cli_state *do_connect(char *server, char *share)
                            password, strlen(password)+1)) {
                DEBUG(0,("tree connect failed: %s\n", cli_errstr(c)));
                cli_shutdown(c);
+               free(c);
                return NULL;
        }