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.
This commit is contained in:
Richard W.M. Jones
2012-11-26 08:58:26 +00:00
parent d2c75dd0ff
commit 8243c0c6f6

View File

@@ -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