[hw/xfree86 6/7] hw/xfree86/common/xf86sbusBus.c: Fix leak

Niels Thykier niels at thykier.net
Fri Nov 2 02:41:52 PDT 2012


Signed-off-by: Niels Thykier <niels at thykier.net>
---
 hw/xfree86/common/xf86sbusBus.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/xfree86/common/xf86sbusBus.c b/hw/xfree86/common/xf86sbusBus.c
index b6a6b94..0e9ece0 100644
--- a/hw/xfree86/common/xf86sbusBus.c
+++ b/hw/xfree86/common/xf86sbusBus.c
@@ -641,11 +641,12 @@ xf86SbusCmapLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
     int i, index;
     sbusCmapPtr cmap;
     struct fbcmap fbcmap;
-    unsigned char *data = malloc(numColors * 3);
+    unsigned char *data;
 
     cmap = SBUSCMAPPTR(pScrn->pScreen);
     if (!cmap)
         return;
+    data  = malloc(numColors * 3);
     fbcmap.count = 0;
     fbcmap.index = indices[0];
     fbcmap.red = data;
-- 
1.7.10.4



More information about the xorg-devel mailing list