[PATCH] uefi: uefidump: missing va_end on str == NULL return path

IvanHu ivan.hu at canonical.com
Thu May 16 03:47:48 UTC 2013


On 05/07/2013 07:56 AM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Coverity CID #997322, Missing varargs init or cleanup (VARARGS)
>
> Coverity detected a missing va_end on the str == NULL error
> return path.  Fix this by using va_end() immediately after we
> finish using args.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>   src/uefi/uefidump/uefidump.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/src/uefi/uefidump/uefidump.c b/src/uefi/uefidump/uefidump.c
> index 771f904..fa914ba 100644
> --- a/src/uefi/uefidump/uefidump.c
> +++ b/src/uefi/uefidump/uefidump.c
> @@ -60,8 +60,8 @@ static char *uefidump_vprintf(char *str, const char *fmt, ...)
>   	char buffer[4096];
>
>   	va_start(args, fmt);
> -
>   	vsnprintf(buffer, sizeof(buffer), fmt, args);
> +	va_end(args);
>
>   	if (str == NULL)
>   		str = strdup(buffer);
> @@ -72,7 +72,6 @@ static char *uefidump_vprintf(char *str, const char *fmt, ...)
>   		strcat(str, buffer);
>   	}
>
> -	va_end(args);
>   	return str;
>   }
>
>

Acked-by: Ivan Hu <ivan.hu at canonical.com>



More information about the fwts-devel mailing list