From 8243c0c6f66e50aab7593d34d090baae4cfa66db Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 26 Nov 2012 08:58:26 +0000 Subject: lib: lpj: Only return first match in read_all function. If there where several lpj=.. matches then the earlier matches would be leaked. Only return the first one and don't leak memory. --- src/lpj.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lpj.c b/src/lpj.c index f927eefc..d6492de5 100644 --- a/src/lpj.c +++ b/src/lpj.c @@ -111,7 +111,8 @@ read_all (guestfs_h *g, void *retv, const char *buf, size_t len) { char **ret = retv; - *ret = safe_strndup (g, buf, len); + if (!*ret) + *ret = safe_strndup (g, buf, len); } static int -- cgit