mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
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@aepfle.de> Reviewed-by: Juergen Gross <jgross@suse.com> Compile-tested-by: Jason Andryuk <jandryuk@gmail.com> Acked-by: Jan Beulich <jbeulich@suse.com>