diff options
Diffstat (limited to 'softmmu/dma-helpers.c')
-rw-r--r-- | softmmu/dma-helpers.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/softmmu/dma-helpers.c b/softmmu/dma-helpers.c index 160095e4ba..7820fec54c 100644 --- a/softmmu/dma-helpers.c +++ b/softmmu/dma-helpers.c @@ -29,7 +29,7 @@ MemTxResult dma_memory_set(AddressSpace *as, dma_addr_t addr, void qemu_sglist_init(QEMUSGList *qsg, DeviceState *dev, int alloc_hint, AddressSpace *as) { - qsg->sg = g_malloc(alloc_hint * sizeof(ScatterGatherEntry)); + qsg->sg = g_new(ScatterGatherEntry, alloc_hint); qsg->nsg = 0; qsg->nalloc = alloc_hint; qsg->size = 0; @@ -42,7 +42,7 @@ void qemu_sglist_add(QEMUSGList *qsg, dma_addr_t base, dma_addr_t len) { if (qsg->nsg == qsg->nalloc) { qsg->nalloc = 2 * qsg->nalloc + 1; - qsg->sg = g_realloc(qsg->sg, qsg->nalloc * sizeof(ScatterGatherEntry)); + qsg->sg = g_renew(ScatterGatherEntry, qsg->sg, qsg->nalloc); } qsg->sg[qsg->nsg].base = base; qsg->sg[qsg->nsg].len = len; |