1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

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.
This commit is contained in:
Zdenek Kabelac 2012-10-13 19:19:50 +02:00
parent 5df6ec24bf
commit 4379365cae
2 changed files with 5 additions and 3 deletions

1
lib/cache/lvmetad.c vendored
View File

@ -880,6 +880,7 @@ int lvmetad_pvscan_all_devs(struct cmd_context *cmd, activation_handler handler)
future_token = _lvmetad_token;
_lvmetad_token = (char *) "update in progress";
if (!_token_update()) {
dev_iter_destroy(iter);
_lvmetad_token = future_token;
return 0;
}

View File

@ -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);