bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Patch: fix various issues found by static analysis


From: Patrice Dumas
Subject: Re: Patch: fix various issues found by static analysis
Date: Tue, 15 Oct 2024 20:11:02 +0200

On Tue, Oct 15, 2024 at 12:36:59PM +0200, Vitezslav Crhonek wrote:
> Hi,
> 
> Please review proposed fixes of issues found by static analysis
> of texinfo-7.1 in the attached patch and consider applying them.
> 
> @@ -2949,7 +2949,7 @@ DECLARE_INFO_COMMAND (info_menu_sequence,
>  static int
>  info_handle_pointer (const char *label, WINDOW *window)
>  {
> -  char *description;
> +  char *description = NULL;
>    NODE *node;
>  
>    if (!strcmp (label, "Up"))

I recently changed the function above by adding

  else /* Should not happen */
    abort ();

I think that this could make clearer for the code analyser that
description does not need to be initialized.

> diff --git a/info/util.c b/info/util.c
> index 7ecb90f06b..a511471b9f 100644
> --- a/info/util.c
> +++ b/info/util.c
> @@ -34,9 +34,12 @@ xvasprintf (char **ptr, const char *template, va_list ap)
>  int
>  xasprintf (char **ptr, const char *template, ...)
>  {
> +  int ret;
>    va_list v;
>    va_start (v, template);
> -  return xvasprintf (ptr, template, v);
> +  ret =  xvasprintf (ptr, template, v);
> +  va_end (v);
> +  return ret;
>  }

If the above change is relevant (looks like so to me), we should
probably do it in texi2any C code that is very similar too.

-- 
Pat



reply via email to

[Prev in Thread] Current Thread [Next in Thread]