Message ID | 4AFBDB53.7020400@suse.de |
---|---|
State | New |
Headers | show |
diff --git a/dma-helpers.c b/dma-helpers.c index 712ed89..0c57648 100644 --- a/dma-helpers.c +++ b/dma-helpers.c @@ -12,7 +12,10 @@ void qemu_sglist_init(QEMUSGList *qsg, int alloc_hint) { - qsg->sg = qemu_malloc(alloc_hint * sizeof(ScatterGatherEntry)); + if (alloc_hint > 0) + qsg->sg = qemu_malloc(alloc_hint * sizeof(ScatterGatherEntry)); + else + qsg->sg = NULL; qsg->nsg = 0; qsg->nalloc = alloc_hint; qsg->size = 0;