summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-07-26 16:05:26 +0200
committerLennart Poettering <lennart@poettering.net>2012-07-26 16:56:21 +0200
commit46b0d922256b62bc8291951d9868c243ced80c9a (patch)
treee3ade410860a25bd5a35dc0d67bf32ad59f649f6 /src
parentb5dd874ddad5857a6bb418e6a1cdf318e71ca69c (diff)
logs-show: fix OOM path
Diffstat (limited to 'src')
-rw-r--r--src/shared/logs-show.c5
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;