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

lvmetad: fix memleaks

Release allocated buffers in daemon_logf, daemon_log_parse
This commit is contained in:
Zdenek Kabelac 2012-08-16 20:10:35 +02:00
parent 00877fe47b
commit 8edc0e450d
2 changed files with 7 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.98
=================================
Fix buffer memory leak in lvmetad logging.
Use 'ignore' discards for thin metadata created with older versions.
Use proper condition to check for unsupported discards settings.
Update lvs manpage with discards (2.02.97).

View File

@ -59,6 +59,7 @@ void daemon_logf(log_state *s, int type, const char *fmt, ...) {
if (dm_vasprintf(&buf, fmt, ap) < 0)
return; /* _0 */
daemon_log(s, type, buf);
dm_free(buf);
}
struct log_line_baton {
@ -134,10 +135,14 @@ int daemon_log_parse(log_state *s, int outlet, const char *types, int enable)
char *next = strchr(pos, ',');
if (next)
*next = 0;
if (!_parse_one(s, outlet, pos, enable))
if (!_parse_one(s, outlet, pos, enable)) {
dm_free(buf);
return 0;
}
pos = next ? next + 1 : 0;
}
dm_free(buf);
return 1;
}