Mao Zhongyi <maozhon...@cmss.chinamobile.com> writes:
> Cc: arm...@redhat.com > Cc: laur...@vivier.eu > Cc: tony.ngu...@bt.com > > Signed-off-by: Mao Zhongyi <maozhon...@cmss.chinamobile.com> > --- > tests/migration/stress.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/tests/migration/stress.c b/tests/migration/stress.c > index d9aa4afe92..e6c9a6b243 100644 > --- a/tests/migration/stress.c > +++ b/tests/migration/stress.c > @@ -181,6 +181,8 @@ static int stressone(unsigned long long ramsizeMB) > if (!ram) { > fprintf(stderr, "%s (%05d): ERROR: cannot allocate %llu MB of RAM: > %s\n", > argv0, gettid(), ramsizeMB, strerror(errno)); > + if (data) > + free(data); I wonder if it's worth using the glib macros here so: g_autofree char *data = g_malloc(PAGE_SIZE); and the same for ram. You can then drop the frees. > return -1; > } > if (!data) { -- Alex Bennée