Code

client: Fixed a memory leak in case connection setup fails.
authorSebastian Harl <sh@tokkee.org>
Tue, 29 Apr 2014 17:47:18 +0000 (19:47 +0200)
committerSebastian Harl <sh@tokkee.org>
Tue, 29 Apr 2014 17:47:18 +0000 (19:47 +0200)
src/client/sock.c

index 6337ee6bf8cd8bf71611a42469b55527b7b84ff8..805dc1d1ce5350da8d1aaced43d9bce53df1d9cd 100644 (file)
@@ -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];