summaryrefslogtreecommitdiff
path: root/libdaemon
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2012-10-13 19:19:50 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2012-10-13 19:19:50 +0200
commit4379365cae3a1efa8299e0d6cf248520a136c798 (patch)
tree01c393bae40bfdab9e58901e63c019bf795308d7 /libdaemon
parent5df6ec24bffc2df7028639f06b580eda46d894df (diff)
downloadlvm2-4379365cae3a1efa8299e0d6cf248520a136c798.tar.gz
lvmetad: fix memory leaks in error paths
Destroy interator in error path. Releasy any possible allocated buffer from buffer_append_f and buffer_append_vf in error path.
Diffstat (limited to 'libdaemon')
-rw-r--r--libdaemon/client/daemon-client.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libdaemon/client/daemon-client.c b/libdaemon/client/daemon-client.c
index c4422d68a..a010cc045 100644
--- a/libdaemon/client/daemon-client.c
+++ b/libdaemon/client/daemon-client.c
@@ -108,10 +108,11 @@ daemon_reply daemon_send_simple_v(daemon_handle h, const char *id, va_list ap)
daemon_request rq = { .cft = NULL };
daemon_reply repl;
- if (!buffer_append_f(&rq.buffer, "request = %s", id, NULL))
- return err;
- if (!buffer_append_vf(&rq.buffer, ap))
+ if (!buffer_append_f(&rq.buffer, "request = %s", id, NULL) ||
+ !buffer_append_vf(&rq.buffer, ap)) {
+ buffer_destroy(&rq.buffer);
return err;
+ }
repl = daemon_send(h, rq);
buffer_destroy(&rq.buffer);