Message ID | 1453112751-725-1-git-send-email-pbonzini@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, Jan 18, 2016 at 11:25:51AM +0100, Paolo Bonzini wrote: > drv leaks if qemu_chr_alloc returns an error. > > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> > --- > qemu-char.c | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Regards, Daniel
diff --git a/qemu-char.c b/qemu-char.c index 9e2217b..2633b8a 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -1778,18 +1778,19 @@ static CharDriverState *qemu_chr_open_pp_fd(int fd, return NULL; } - drv = g_new0(ParallelCharDriver, 1); - drv->fd = fd; - drv->mode = IEEE1284_MODE_COMPAT; - chr = qemu_chr_alloc(backend, errp); if (!chr) { return NULL; } + + drv = g_new0(ParallelCharDriver, 1); + chr->opaque = drv; chr->chr_write = null_chr_write; chr->chr_ioctl = pp_ioctl; chr->chr_close = pp_close; - chr->opaque = drv; + + drv->fd = fd; + drv->mode = IEEE1284_MODE_COMPAT; return chr; }
drv leaks if qemu_chr_alloc returns an error. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- qemu-char.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)