| Summary: | Memory leak in SDL_CreateYUV_SW | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Nitz <nitin.j4> |
| Component: | video | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED INVALID | QA Contact: | Sam Lantinga <slouken> |
| Severity: | critical | ||
| Priority: | P2 | CC: | arvin.mittal, philipp.wiesemann |
| Version: | 1.2.15 | ||
| Hardware: | x86 | ||
| OS: | Linux | ||
| Attachments: | Patch | ||
Seems a duplicate of bug 2334 but the patch is different there. Created attachment 1920 [details]
Patch
This patch is tested and having no issue.
Yes Mr.Philipp that seems to be an duplicate issue reported by someone else. I attached the final path which has been tested having no issue. So it is safe to apply. Thanks!!! From looking at the source of SDL_yuv_sw.c it seems to me that all three pointers would also be deleted with SDL_FreeYUVOverlay() because it indirectly calls SDL_FreeYUV_SW(). If this is the case there would be no leak. *** Bug 2334 has been marked as a duplicate of this bug. *** Ohh yee you are right.... thanks for your inputs :) Resolved as invalid because there seems to be no leak. See previous discussion. |
In SDL_Overlay *SDL_CreateYUV_SW(_THIS, int width, int height, Uint32 format, SDL_Surface *display) function, 3 pointers are getting leak: 1. swdata->pixels 2. swdata->colortab 3. swdata->rgb_2_pix at this point: if ( ! swdata->pixels || ! swdata->colortab || ! swdata->rgb_2_pix ) { SDL_OutOfMemory(); SDL_FreeYUVOverlay(overlay); return(NULL); } Patch: swdata->pixels = (Uint8 *) SDL_malloc(width*height*2); if(! swdata->pixels) { SDL_OutOfMemory(); SDL_FreeYUVOverlay(overlay); return(NULL); } swdata->colortab = (int *)SDL_malloc(4*256*sizeof(int)); if(! swdata->colortab ) { SDL_free(swdata->pixels); SDL_OutOfMemory(); SDL_FreeYUVOverlay(overlay); return(NULL); } swdata->rgb_2_pix = (Uint32 *)SDL_malloc(3*768*sizeof(Uint32)); if(! swdata->rgb_2_pix) { SDL_free(swdata->pixels); SDL_free(swdata->colortab); SDL_OutOfMemory(); SDL_FreeYUVOverlay(overlay); return(NULL); } Cr_r_tab = &swdata->colortab[0*256]; Cr_g_tab = &swdata->colortab[1*256]; Cb_g_tab = &swdata->colortab[2*256]; Cb_b_tab = &swdata->colortab[3*256]; r_2_pix_alloc = &swdata->rgb_2_pix[0*768]; g_2_pix_alloc = &swdata->rgb_2_pix[1*768]; b_2_pix_alloc = &swdata->rgb_2_pix[2*768]; Thanks