We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1805 - Memory Leak issue in src/video/x11/edid-parse.c file
Summary: Memory Leak issue in src/video/x11/edid-parse.c file
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 2.0.0
Hardware: x86 Linux
: P2 critical
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-16 02:31 UTC by Nitz
Modified: 2013-04-17 04:39 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nitz 2013-04-16 02:31:01 UTC
In Function,
 
MonitorInfo *
decode_edid (const uchar *edid)
{
    MonitorInfo *info = calloc (1, sizeof (MonitorInfo));

    decode_check_sum (edid, info);

    if (!decode_header (edid)) 
        return NULL;

    if (!decode_vendor_and_product_identification (edid, info))
        return NULL;

    if (!decode_edid_version (edid, info))
        return NULL;

    if (!decode_display_parameters (edid, info))
        return NULL;

    if (!decode_color_characteristics (edid, info))
        return NULL;

    if (!decode_established_timings (edid, info))
        return NULL;

    if (!decode_standard_timings (edid, info))
        return NULL;

    if (!decode_descriptors (edid, info))
        return NULL;

    return info;
}

In this function "info" is going out of scope and leaks the storage it points to, if the first if condition get true: 
if (!decode_header (edid)) 
        return NULL;

So while returning from this if statement there should be free for "info" pointer.
Comment 1 Sam Lantinga 2013-04-17 04:39:31 UTC
Fixed, thanks!
http://hg.libsdl.org/SDL/rev/1d9b4b7a8ce3