Skip to content

Commit

Permalink
usb: ehci: fix memory leak in ehci_init_transfer
Browse files Browse the repository at this point in the history
In ehci_init_transfer function, if the 'cpage' is bigger than 4,
it doesn't free the 'p->sgl' once allocated previously thus leading
a memory leak issue. This patch avoid this.

Signed-off-by: Li Qiang <liqiang6-s@360.cn>
Message-id: 5821c0f4.091c6b0a.e0c92.e811@mx.google.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
  • Loading branch information
Li Qiang authored and stefanhaRH committed Nov 10, 2016
1 parent 423f7cf commit 791f977
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions hw/usb/hcd-ehci.c
Expand Up @@ -1190,6 +1190,7 @@ static int ehci_init_transfer(EHCIPacket *p)
while (bytes > 0) {
if (cpage > 4) {
fprintf(stderr, "cpage out of range (%d)\n", cpage);
qemu_sglist_destroy(&p->sgl);
return -1;
}

Expand Down

0 comments on commit 791f977

Please sign in to comment.