diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-07-26 16:05:26 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-07-26 16:56:21 +0200 |
commit | 46b0d922256b62bc8291951d9868c243ced80c9a (patch) | |
tree | e3ade410860a25bd5a35dc0d67bf32ad59f649f6 /src/shared/logs-show.c | |
parent | b5dd874ddad5857a6bb418e6a1cdf318e71ca69c (diff) |
logs-show: fix OOM path
Diffstat (limited to 'src/shared/logs-show.c')
-rw-r--r-- | src/shared/logs-show.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c index edb5a9cafb..375ca543c1 100644 --- a/src/shared/logs-show.c +++ b/src/shared/logs-show.c @@ -50,11 +50,12 @@ static int parse_field(const void *data, size_t length, const char *field, char nl = length - fl; buf = malloc(nl+1); - memcpy(buf, (const char*) data + fl, nl); - ((char*)buf)[nl] = 0; if (!buf) return log_oom(); + memcpy(buf, (const char*) data + fl, nl); + ((char*)buf)[nl] = 0; + free(*target); *target = buf; *target_size = nl; |