From: Sebastian Harl Date: Sun, 20 Jul 2014 20:34:42 +0000 (+0200) Subject: sysdb: Fixed a memory leak in an error condition. X-Git-Tag: sysdb-0.3.0~37 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=0b865cb35c5f74e96c1cf984e5c9cff57efd8269;p=sysdb.git sysdb: Fixed a memory leak in an error condition. Thanks to clang-analyze for identifying this! --- diff --git a/src/tools/sysdb/command.c b/src/tools/sysdb/command.c index 505124c..9dfb619 100644 --- a/src/tools/sysdb/command.c +++ b/src/tools/sysdb/command.c @@ -40,6 +40,7 @@ #include #include +#include #include /* @@ -117,8 +118,11 @@ sdb_command_exec(sdb_input_t *input) * sends back. We'll wait for the first reply and then return to the * main loop which will handle any subsequent replies, including * eventually the reply to the query (if it's not the first reply). */ - if (sdb_command_print_reply(input->client) < 0) + if (sdb_command_print_reply(input->client) < 0) { + if (data) + free(data); return NULL; + } } sdb_strbuf_skip(input->input, 0, input->query_len);