Please do not reply to this email: if you want to comment on the bug, go to
the URL shown below and enter yourcomments there.
https://bugs.freedesktop.org/show_bug.cgi?id=5557
Summary: Memory Leaks in arbprogparse.c
Product: Mesa
Version: CVS
Platform: PC
OS/Version: Windows 2000
Status: NEW
Severity: minor
Priority: P4
Component: Mesa core
AssignedTo: [email protected]
ReportedBy: [EMAIL PROTECTED]
There are three areas causing memory leaks within this file, which I will take
as a single and a double.
On line 3884 a call to grammar check is made during which memory is assigned to
the variable "parsed". This memory is not released before the subsequent call
to grammer_fast_check at line 3953. Thereafter the second allocation
to "parsed" is freed at line 4035. To rectify this a copy of line 4035 should
be inserted between the two grammar_check calls.
Subsequently while parsing the function "parse_param_use" at line 1934
calls "mesa_strdup" to duplicate a string to be stored in the
variable 'param_var->name'. Similarly in the function "parse_source_reg" at
line 2463 there is a call to "mesa_strdup" to duplicate a string to be stored
in the variable 'src->name'. Both 'param_var' and 'src' are of type 'struct
var_cache*'. When this structure is later deleted the variable 'name' is not
freed, possibly because it could have been allocated by the user rather than by
mesa internally. I overcame this problem by declaring an additional variable in
the structure definition commencing at line 519
GLuint name_allocated;
In the function "var_cache_create" at lines 547ff I added a line to to
initialise the new variable to 0.
(**va).name_allocated = 0;
In the two functions referred to above I added additional lines to set the
variable to 1 when the "_mesa_strdup" function was called.
param_var->name_allocated = 1;
src->name_allocated = 1;
Finally, in the function var_cache_destroy at lines 566ff I added the following
two lines to free any allocated memory
if ((*va)->name_allocated)
mesa_free ((*va)->name);
With these changes the memory leaks were eliminated.
--
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev