Bug 96480 - possible memory leak in mipmap.c
Summary: possible memory leak in mipmap.c
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: GLU (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: amarnath.valluri
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-10 11:01 UTC by amarnath.valluri
Modified: 2016-06-10 15:50 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Fixes the menory leak (1.22 KB, patch)
2016-06-10 11:09 UTC, amarnath.valluri
Details | Splinter Review

Description amarnath.valluri 2016-06-10 11:01:43 UTC
There is a possible memory leak in function gluBuild2DMipmapLevelsCore() in case of OUT_OF_MEMORY

void *newMipmapImage= malloc((size_t) (newRowLength*newheight));
if (newMipmapImage == NULL) {
      glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment);
       glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows);
       glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels);
       glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length);
       glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes);
       return GLU_OUT_OF_MEMORY;
}

In this case memory allocated for both 'srcImage' and 'dstImage' is leaked.
Comment 1 amarnath.valluri 2016-06-10 11:09:28 UTC
Created attachment 124449 [details] [review]
Fixes the menory leak

This patch fixes the memory leak.
Comment 2 Timothy Arceri 2016-06-10 12:34:55 UTC
Patches should be send to the mesa-dev@lists.freedesktop.org mailing list see: http://mesa3d.org/devinfo.html#submitting

Also you should only set the bug to resolved/fix if the patch has been pushed to git otherwise none will ever see the bug.
Comment 3 amarnath.valluri 2016-06-10 12:44:59 UTC
I have submitted the patch to mesa-dev list.

Thanks for the pointers. I reopened the bug.
Comment 4 Brian Paul 2016-06-10 15:12:41 UTC
Patch updated and committed.  0bf42e41c8b63fc2488dd8d41f696310b5a5a6a7
Comment 5 Dieter Nützel 2016-06-10 15:42:30 UTC
Where...
Can't find it in master.

Or how long does it take to sync 'your' master and 'master'...;-)
Comment 6 Dieter Nützel 2016-06-10 15:50:57 UTC
Argh...

'GLU' was slipped through.

Sorry, for the noise.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.