From: Sebastian Harl Date: Tue, 29 Apr 2014 17:47:18 +0000 (+0200) Subject: client: Fixed a memory leak in case connection setup fails. X-Git-Tag: sysdb-0.1.0~65 X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=commitdiff_plain;h=d8ee362a5a46595b8214b023546dce0bfed46310 client: Fixed a memory leak in case connection setup fails. --- diff --git a/src/client/sock.c b/src/client/sock.c index 6337ee6..805dc1d 100644 --- a/src/client/sock.c +++ b/src/client/sock.c @@ -179,8 +179,10 @@ sdb_client_connect(sdb_client_t *client, const char *username) buf = sdb_strbuf_create(64); rstatus = 0; status = sdb_client_recv(client, &rstatus, buf); - if ((status > 0) && (rstatus == CONNECTION_OK)) + if ((status > 0) && (rstatus == CONNECTION_OK)) { + sdb_strbuf_destroy(buf); return 0; + } if (status < 0) { char errbuf[1024];