summaryrefslogtreecommitdiffstats
path: root/libdaemon
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2012-08-16 20:10:35 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2012-08-23 14:33:23 +0200
commit8edc0e450da2c0959c44da4811901782cc399649 (patch)
tree6887c2435239b9c325f39713cbb43b27b3d97317 /libdaemon
parent00877fe47b99458e22f6e1c928505fc75aad0752 (diff)
downloadlvm2-8edc0e450da2c0959c44da4811901782cc399649.tar.gz
lvm2-8edc0e450da2c0959c44da4811901782cc399649.tar.xz
lvm2-8edc0e450da2c0959c44da4811901782cc399649.zip
lvmetad: fix memleaks
Release allocated buffers in daemon_logf, daemon_log_parse
Diffstat (limited to 'libdaemon')
-rw-r--r--libdaemon/server/daemon-log.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libdaemon/server/daemon-log.c b/libdaemon/server/daemon-log.c
index caa40cbc..21068bcf 100644
--- a/libdaemon/server/daemon-log.c
+++ b/libdaemon/server/daemon-log.c
@@ -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;
}