[PATCH] ddc: Fix memory leak in GetEDID_DDC1

Keith Packard keithp at keithp.com
Sun Aug 1 19:49:39 PDT 2010


On Sun, 1 Aug 2010 20:13:54 -0400, Matt Turner <mattst88 at gmail.com> wrote:
> On Tue, Jul 27, 2010 at 11:32 PM, Matt Turner <mattst88 at gmail.com> wrote:
> > Mark argument to DDC_checksum as const too.
> >
> > Signed-off-by: Matt Turner <mattst88 at gmail.com>
> > ---
> >  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 7379e95..2d9d4dc 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));
> >  }
> >
> > --
> > 1.7.1
> 
> Please vacuum this up, Keith. Thanks!

You're welcome! Thanks for the bug fix :-)

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20100801/67db0389/attachment.pgp>


More information about the xorg-devel mailing list