[PATCH] Freeing EDID_block attached to nowhere

Masatake YAMATO yamato at redhat.com
Tue Jul 27 00:56:16 PDT 2010


EDID_block is allocated dynamically and attached to xf86MonPtr object in
the function where the object is initialized.
When the initilization fails, EDID_block should be freed.

Signed-off-by: Masatake YAMATO <yamato at redhat.com>
---
 hw/xfree86/ddc/ddc.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/hw/xfree86/ddc/ddc.c b/hw/xfree86/ddc/ddc.c
index 7379e95..873c674 100644
--- a/hw/xfree86/ddc/ddc.c
+++ b/hw/xfree86/ddc/ddc.c
@@ -262,6 +262,8 @@ xf86DoEDID_DDC1(
 
     if (EDID_block){
 	tmp = xf86InterpretEDID(scrnIndex,EDID_block);
+	if (!tmp)
+	  free(EDID_block);
     }
 #ifdef DEBUG
 	else ErrorF("No EDID block returned\n");
@@ -423,6 +425,8 @@ xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool complete)
 	}
 
 	tmp = xf86InterpretEEDID(scrnIndex, EDID_block);
+	if (!tmp)
+	  free(EDID_block);
     }
 
     if (tmp && complete)
-- 
1.6.2.5



More information about the xorg-devel mailing list