diff options
Diffstat (limited to 'src/shared')
-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; |