On 18 May 2018 at 18:19, Peter Maydell <peter.mayd...@linaro.org> wrote:
> From: Francisco Iglesias <frasse.igles...@gmail.com>
>
> Add a model of the generic DMA found on Xilinx ZynqMP.

Hi; the latest Coverity run finds a couple of issues in this code:


> +static uint64_t zdma_read(void *opaque, hwaddr addr, unsigned size)
> +{
> +    XlnxZDMA *s = XLNX_ZDMA(opaque);
> +    RegisterInfo *r = &s->regs_info[addr / 4];
> +
> +    if (!r->data) {
> +        qemu_log("%s: Decode error: read from %" HWADDR_PRIx "\n",
> +                 object_get_canonical_path(OBJECT(s)),
> +                 addr);

object_get_canonical_path() returns a string that the caller
takes ownership of, so you have to g_free() it when you've
finished with it. (CID 1391294)

> +        ARRAY_FIELD_DP32(s->regs, ZDMA_CH_ISR, INV_APB, true);
> +        zdma_ch_imr_update_irq(s);
> +        return 0;
> +    }
> +    return register_read(r, ~0, NULL, false);
> +}
> +
> +static void zdma_write(void *opaque, hwaddr addr, uint64_t value,
> +                      unsigned size)
> +{
> +    XlnxZDMA *s = XLNX_ZDMA(opaque);
> +    RegisterInfo *r = &s->regs_info[addr / 4];
> +
> +    if (!r->data) {
> +        qemu_log("%s: Decode error: write to %" HWADDR_PRIx "=%" PRIx64 "\n",
> +                 object_get_canonical_path(OBJECT(s)),
> +                 addr, value);

Similarly here. (CID 1391293)

> +        ARRAY_FIELD_DP32(s->regs, ZDMA_CH_ISR, INV_APB, true);
> +        zdma_ch_imr_update_irq(s);
> +        return;
> +    }
> +    register_write(r, value, ~0, NULL, false);
> +}

Could you write a patch that adds the missing g_free()s, please?

thanks
-- PMM

Reply via email to