aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2011-01-06 00:47:37 +0100
committerDaniel Stenberg <daniel@haxx.se>2011-01-08 19:14:28 +0100
commita9cd4f4ed49e1a0b79f8fc6a0cb129331fa04f23 (patch)
tree8de2ea20715d6c8275abf4604de6e9eb6ea1d491
parent1d28efb9d1759bcbc81d28e462c2e3a5d60a17e4 (diff)
gtls: fix memory leak
Bug: http://curl.haxx.se/mail/lib-2011-01/0079.html Reported by: Quinn Slack
-rw-r--r--lib/gtls.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/gtls.c b/lib/gtls.c
index 804f78446..9a87c39a8 100644
--- a/lib/gtls.c
+++ b/lib/gtls.c
@@ -483,6 +483,7 @@ gtls_connect_step3(struct connectdata *conn,
int rc;
int incache;
void *ssl_sessionid;
+ CURLcode result = CURLE_OK;
/* This function will return the peer's raw certificate (chain) as sent by
the peer. These certificates are in raw format (DER encoded for
@@ -701,11 +702,17 @@ gtls_connect_step3(struct connectdata *conn,
}
/* store this session id */
- return Curl_ssl_addsessionid(conn, connect_sessionid, connect_idsize);
+ result = Curl_ssl_addsessionid(conn, connect_sessionid, connect_idsize);
+ if(result) {
+ free(connect_sessionid);
+ result = CURLE_OUT_OF_MEMORY;
+ }
}
+ else
+ result = CURLE_OUT_OF_MEMORY;
}
- return CURLE_OK;
+ return result;
}