diff options
author | Matt Turner <mattst88@gmail.com> | 2010-07-27 23:32:36 -0400 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2010-08-01 22:48:21 -0400 |
commit | 7e0575baf14ec4a89492fd2780f9ab5b9244afbd (patch) | |
tree | 2ef239eb72e54a8cff37321b9c225458c9e2e889 | |
parent | 750d4e82a0c1161292d24216bcff200cd6647611 (diff) |
ddc: Fix memory leak in GetEDID_DDC1
Mark argument to DDC_checksum as const too.
Signed-off-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | hw/xfree86/ddc/ddc.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/hw/xfree86/ddc/ddc.c b/hw/xfree86/ddc/ddc.c index 7379e959b..2d9d4dcd2 100644 --- a/hw/xfree86/ddc/ddc.c +++ b/hw/xfree86/ddc/ddc.c @@ -102,7 +102,7 @@ resort(unsigned char *s_block) } static int -DDC_checksum(unsigned char *block, int len) +DDC_checksum(const unsigned char *block, int len) { int i, result = 0; int not_null = 0; @@ -149,7 +149,10 @@ GetEDID_DDC1(unsigned int *s_ptr) d_pos++; } free(s_ptr); - if (d_block && DDC_checksum(d_block,EDID1_LEN)) return NULL; + if (d_block && DDC_checksum(d_block,EDID1_LEN)) { + free(d_block); + return NULL; + } return (resort(d_block)); } |