From a6234ad6f297611bcd00f67d388de532d1a6874f Mon Sep 17 00:00:00 2001
From: Tim Potter <tpot@samba.org>
Date: Mon, 6 Aug 2001 23:29:25 +0000
Subject: Fixed another possible memleak in cli_initialise() (This used to be
 commit 4c9f010a1eef81addfea0315bef81570bc604f8a)

---
 source3/libsmb/clientgen.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 79fa224e8f..ba852dea52 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -152,11 +152,14 @@ initialise a client structure
 ****************************************************************************/
 struct cli_state *cli_initialise(struct cli_state *cli)
 {
+        BOOL alloced_cli = False;
+
 	if (!cli) {
 		cli = (struct cli_state *)malloc(sizeof(*cli));
 		if (!cli)
 			return NULL;
 		ZERO_STRUCTP(cli);
+                alloced_cli = True;
 	}
 
 	if (cli->initialised) {
@@ -201,6 +204,9 @@ struct cli_state *cli_initialise(struct cli_state *cli)
         safe_free(cli->inbuf);
         safe_free(cli->outbuf);
 
+        if (alloced_cli)
+                safe_free(cli);
+
         return NULL;
 }
 
-- 
cgit