mirror of https://github.com/xqemu/xqemu.git
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>
This commit is contained in:
parent
9e4eff5b54
commit
2dc7fdf33d
|
@ -669,6 +669,7 @@ static MTPData *usb_mtp_get_object(MTPState *s, MTPControl *c,
|
||||||
|
|
||||||
d->fd = open(o->path, O_RDONLY);
|
d->fd = open(o->path, O_RDONLY);
|
||||||
if (d->fd == -1) {
|
if (d->fd == -1) {
|
||||||
|
usb_mtp_data_free(d);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
d->length = o->stat.st_size;
|
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);
|
d->fd = open(o->path, O_RDONLY);
|
||||||
if (d->fd == -1) {
|
if (d->fd == -1) {
|
||||||
|
usb_mtp_data_free(d);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue