[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v1] tools/libs/guest: assist gcc13's realloc analyzer
On Wed, Apr 19, 2023 at 8:55 AM Juergen Gross <jgross@xxxxxxxx> wrote: > > On 19.04.23 12:06, Olaf Hering wrote: > > gcc13 fails to track the allocated memory in backup_ptes: > > > > xg_offline_page.c: In function 'backup_ptes': > > xg_offline_page.c:191:13: error: pointer 'orig' may be used after 'realloc' > > [-Werror=use-after-free] > > 191 | free(orig); > > > > Assist the analyzer by slightly rearranging the code: > > In case realloc succeeds, the previous allocation is either extended > > or released internally. In case realloc fails, the previous allocation > > is left unchanged. Return an error in this case, the caller will > > release the currently allocated memory in its error path. > > > > http://bugzilla.suse.com/show_bug.cgi?id=1210570 > > > > Signed-off-by: Olaf Hering <olaf@xxxxxxxxx> > > Reviewed-by: Juergen Gross <jgross@xxxxxxxx> Compile-tested-by: Jason Andryuk <jandryuk@xxxxxxxxx> Needed to build on Fedora 38. Thanks, Jason
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |