Vishal Verma wrote:
> A GCC update (12.1.1) now produces a warning in the xrealloc() wrapper
> (originally copied from git, and used in strbuf operations):
> 
>   ../util/wrapper.c: In function ‘xrealloc’:
>   ../util/wrapper.c:34:31: warning: pointer ‘ptr’ may be used after ‘realloc’ 
> [-Wuse-after-free]
>      34 |                         ret = realloc(ptr, 1);
>         |                               ^~~~~~~~~~~~~~~
> 
> Pull in an updated definition for xrealloc() from the git project to fix this.
> 
> Cc: Dan Williams <[email protected]>
> Signed-off-by: Vishal Verma <[email protected]>

Looks like a faithful reproduction of what upstream git did minus the
memory_limit_check() infra, but we can think about that later.

Reviewed-by: Dan Williams <[email protected]>

Reply via email to