[PATCH 4/4] tools: hv: Parse /etc/os-release

Alan Cox alan at lxorguk.ukuu.org.uk
Wed Sep 5 16:58:10 UTC 2012


> +			if (!strcmp(buf, "NAME"))
> +				os_name = strdup(value);
> +			else if (!strcmp(buf, "VERSION_ID"))
> +				os_major = strdup(value);

strdup can fail. The case where it leaks because NAME= occurs twice is
harmless enough but the strdup ought to be checked or add an x_strdup()
helper.

Alan



More information about the devel mailing list