diff options
author | Gerd Hoffmann | 2014-04-25 12:01:55 +0200 |
---|---|---|
committer | Gerd Hoffmann | 2014-05-05 12:57:45 +0200 |
commit | 2dc7fdf33d28940255f171b8ea4b692d9d5b7a7d (patch) | |
tree | 31d387d4c47ce98a4634feafe548a46c76fa659d | |
parent | usb: mtp: fix serial (must be exact 32 chars) (diff) | |
download | qemu-2dc7fdf33d28940255f171b8ea4b692d9d5b7a7d.tar.gz qemu-2dc7fdf33d28940255f171b8ea4b692d9d5b7a7d.tar.xz qemu-2dc7fdf33d28940255f171b8ea4b692d9d5b7a7d.zip |
usb: mtp: fix error path memory leak
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
-rw-r--r-- | hw/usb/dev-mtp.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c index 775dc8d0b2..45f9562c60 100644 --- a/hw/usb/dev-mtp.c +++ b/hw/usb/dev-mtp.c @@ -669,6 +669,7 @@ static MTPData *usb_mtp_get_object(MTPState *s, MTPControl *c, d->fd = open(o->path, O_RDONLY); if (d->fd == -1) { + usb_mtp_data_free(d); return NULL; } d->length = o->stat.st_size; @@ -688,6 +689,7 @@ static MTPData *usb_mtp_get_partial_object(MTPState *s, MTPControl *c, d->fd = open(o->path, O_RDONLY); if (d->fd == -1) { + usb_mtp_data_free(d); return NULL; } |