Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/nouveau: do not leak in nv20_graph_create

If we return due to an unknown chipset in
drivers/gpu/drm/nouveau/nv20_graph.c:nv20_graph_create() we'll leak the
memory allocated to 'pgraph'.

This patch should fix the leak.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Reviewed-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>

authored by

Jesper Juhl and committed by
Ben Skeggs
1541fa85 88c8431c

+2
+2
drivers/gpu/drm/nouveau/nv20_graph.c
··· 753 753 break; 754 754 default: 755 755 NV_ERROR(dev, "PGRAPH: unknown chipset\n"); 756 + kfree(pgraph); 756 757 return 0; 757 758 } 758 759 } else { ··· 775 774 break; 776 775 default: 777 776 NV_ERROR(dev, "PGRAPH: unknown chipset\n"); 777 + kfree(pgraph); 778 778 return 0; 779 779 } 780 780 }