1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

lvmetad: add check for failure dm_config_write_node

Detect if dm_config_write_node failed and fail correctly.
This commit is contained in:
Zdenek Kabelac 2012-12-14 21:36:27 +01:00
parent 4008f4f891
commit 3e8dbfaecf
3 changed files with 7 additions and 2 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
Check for memory failure of dm_config_write_node() in lvmetad.
Fix socket leak on error path in lvmetad's handle_connect.
Check for failing id_read_format() in _pv_populate_lvmcache.
Fix memleak on error path for lvmetad's pv_found.

View File

@ -77,7 +77,10 @@ daemon_reply daemon_send(daemon_handle h, daemon_request rq)
buffer = rq.buffer;
if (!buffer.mem)
dm_config_write_node(rq.cft->root, buffer_line, &buffer);
if (!dm_config_write_node(rq.cft->root, buffer_line, &buffer)) {
reply.error = ENOMEM;
return reply;
}
assert(buffer.mem);
if (!buffer_write(h.socket_fd, &buffer))

View File

@ -392,7 +392,8 @@ static void *client_thread(void *baton)
res = b->s.handler(b->s, b->client, req);
if (!res.buffer.mem) {
dm_config_write_node(res.cft->root, buffer_line, &res.buffer);
if (!dm_config_write_node(res.cft->root, buffer_line, &res.buffer))
goto fail;
if (!buffer_append(&res.buffer, "\n\n"))
goto fail;
dm_config_destroy(res.cft);