r300g: Fix memory leak on memory allocation failure.
authorVinson Lee <vlee@vmware.com>
Mon, 1 Feb 2010 06:38:25 +0000 (22:38 -0800)
committerVinson Lee <vlee@vmware.com>
Mon, 1 Feb 2010 06:38:25 +0000 (22:38 -0800)
src/gallium/drivers/r300/r300_screen.c

index fa8ed581dae2711017cd6c03543e4aab71dbdf53..4cef9a028afc242d3d7e1d8fc0be82394aec7d58 100644 (file)
@@ -375,8 +375,11 @@ struct pipe_screen* r300_create_screen(struct radeon_winsys* radeon_winsys)
     struct r300_screen* r300screen = CALLOC_STRUCT(r300_screen);
     struct r300_capabilities* caps = CALLOC_STRUCT(r300_capabilities);
 
-    if (!r300screen || !caps)
+    if (!r300screen || !caps) {
+        FREE(r300screen);
+        FREE(caps);
         return NULL;
+    }
 
     caps->pci_id = radeon_winsys->pci_id;
     caps->num_frag_pipes = radeon_winsys->gb_pipes;