@@ -238,6 +238,7 @@ struct sr_save_arrays {
struct sr_restore_arrays {
/* handle_page_data */
xen_pfn_t pfns[MAX_BATCH_SIZE];
+ uint32_t types[MAX_BATCH_SIZE];
};
struct xc_sr_context
@@ -316,7 +316,7 @@ static int handle_page_data(struct xc_sr_context *ctx, struct xc_sr_record *rec)
int rc = -1;
xen_pfn_t *pfns = ctx->restore.m->pfns, pfn;
- uint32_t *types = NULL, type;
+ uint32_t *types = ctx->restore.m->types, type;
/*
* v2 compatibility only exists for x86 streams. This is a bit of a
@@ -363,14 +363,6 @@ static int handle_page_data(struct xc_sr_context *ctx, struct xc_sr_record *rec)
goto err;
}
- types = malloc(pages->count * sizeof(*types));
- if ( !types )
- {
- ERROR("Unable to allocate enough memory for %u pfns",
- pages->count);
- goto err;
- }
-
for ( i = 0; i < pages->count; ++i )
{
pfn = pages->pfn[i] & PAGE_DATA_PFN_MASK;
@@ -410,8 +402,6 @@ static int handle_page_data(struct xc_sr_context *ctx, struct xc_sr_record *rec)
rc = process_page_data(ctx, pages->count, pfns, types,
&pages->pfn[pages->count]);
err:
- free(types);
-
return rc;
}