[Libguestfs] [PATCH] inspect: Don't free uninitialized string.

Pino Toscano ptoscano at redhat.com
Fri Oct 9 11:49:00 UTC 2015


On Friday 09 October 2015 12:34:21 Richard W.M. Jones wrote:
> libguestfs: trace: v2v: read_lines "/etc/os-release"
> [...]
> libguestfs: trace: v2v: read_lines = ["NAME=Fedora", "VERSION="20 (Heisenbug)"", "ID=fedora", "VERSION_ID=20", "PRETTY_NAME="Fedora 20 (Heisenbug)"", "ANSI_COLOR="0;34"", "CPE_NAME="cpe:/o:fedoraproject:fedora:20"", "HOME_URL="https://fedoraproject.org/"", "BUG_REPORT_URL="https://bugzilla.redhat.com/"", "REDHAT_BUGZILLA_PRODUCT="Fedora"", "REDHAT_BUGZILLA_PRODUCT_VERSION=20", "REDHAT_SUPPORT_PRODUCT="Fedora"", "REDHAT_SUPPORT_PRODUCT_VERSION=20"]
> 
> At this point libguestfs segfaulted.
> 
> It seems as if 'major' is not used here, so don't try to free it.
> 
> This fixes commit 32d19e3289bc259901f77398703f16cf6eabd510.
> ---
>  src/inspect-fs-unix.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/src/inspect-fs-unix.c b/src/inspect-fs-unix.c
> index cda1b5d..3d19276 100644
> --- a/src/inspect-fs-unix.c
> +++ b/src/inspect-fs-unix.c
> @@ -232,7 +232,6 @@ parse_os_release (guestfs_h *g, struct inspect_fs *fs, const char *filename)
>          char buf[value_len + 1];
>          snprintf (buf, sizeof buf, "%*s", (int) value_len, value);
>          major_version = guestfs_int_parse_unsigned_int (g, buf);
> -        free (major);
>          /* Handle cases where VERSION_ID is not a number. */
>          if (major_version != -1)
>            minor_version = 0;

ACK.

Sorry for the small regression, and thanks for fixing it.

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20151009/572d902d/attachment.sig>


More information about the Libguestfs mailing list