Commit c916874d60d9daf2e2d5f4f622b185ef57deb6a4

Authored by Julia Lawall
Committed by Dave Airlie
1 parent 21240f9bc1

drivers/gpu/vga/vgaarb.c: add missing kfree

kbuf is a buffer that is local to this function, so all of the error paths
leaving the function should release it.

Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>

Showing 1 changed file with 12 additions and 6 deletions Side-by-side Diff

drivers/gpu/vga/vgaarb.c
... ... @@ -991,14 +991,20 @@
991 991 uc = &priv->cards[i];
992 992 }
993 993  
994   - if (!uc)
995   - return -EINVAL;
  994 + if (!uc) {
  995 + ret_val = -EINVAL;
  996 + goto done;
  997 + }
996 998  
997   - if (io_state & VGA_RSRC_LEGACY_IO && uc->io_cnt == 0)
998   - return -EINVAL;
  999 + if (io_state & VGA_RSRC_LEGACY_IO && uc->io_cnt == 0) {
  1000 + ret_val = -EINVAL;
  1001 + goto done;
  1002 + }
999 1003  
1000   - if (io_state & VGA_RSRC_LEGACY_MEM && uc->mem_cnt == 0)
1001   - return -EINVAL;
  1004 + if (io_state & VGA_RSRC_LEGACY_MEM && uc->mem_cnt == 0) {
  1005 + ret_val = -EINVAL;
  1006 + goto done;
  1007 + }
1002 1008  
1003 1009 vga_put(pdev, io_state);
1004 1010