[Mesa-dev] Fwd: [PATCH] Fixed memory leak.

Mario Rugiero mrugiero at gmail.com
Tue Nov 26 17:47:03 PST 2013


Sorry, I accidentally sent my mail to Alex instead of the list.

---------- Forwarded message ----------
From: Mario Rugiero <mrugiero at gmail.com>
Date: 2013/11/26
Subject: Re: [Mesa-dev] [PATCH] Fixed memory leak.
To: Alex Deucher <alexdeucher at gmail.com>


Hi, I'm an outsider (for everyone who might have not noticed), I started
following the list because I'm interested in the newbie projects, too.
I think this free should be called regardless of new_data being null, as
this doesn't imply there wasn't any in the original object.
So, I believe it should be:

if( bufObj->Data )
   _mesa_align_free( bufObj->Data );

if( new_data ) {
   bufObj->Data = new_data;
...


2013/11/26 Alex Deucher <alexdeucher at gmail.com>

> On Tue, Nov 26, 2013 at 1:22 PM, Siavash Eliasi <siavashserver at gmail.com>
> wrote:
>
> In general, when you fix problems in prior patches, you should
> integrate the fix into the original patch(es) where the problems were,
> update the commit message to note what bugs were fixed and then
> re-send the patch set.  That prevents broken commits from getting into
> the git tree even if they are fixed in a later commit. You can use git
> rebase -i to integrate your fixes.
>
> Alex
>
> > ---
> >  src/mesa/main/bufferobj.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
> > index 5581a5d..e68d96d 100644
> > --- a/src/mesa/main/bufferobj.c
> > +++ b/src/mesa/main/bufferobj.c
> > @@ -420,6 +420,8 @@ _mesa_buffer_data( struct gl_context *ctx, GLenum
> target, GLsizeiptrARB size,
> >
> >     new_data = _mesa_align_malloc( size,
> ctx->Const.MinMapBufferAlignment );
> >     if (new_data) {
> > +      _mesa_align_free( bufObj->Data );
> > +
> >        bufObj->Data = (GLubyte *) new_data;
> >        bufObj->Size = size;
> >        bufObj->Usage = usage;
> > --
> > 1.8.4.2
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20131126/ea1fd145/attachment.html>


More information about the mesa-dev mailing list