Closed Bug 586731 Opened 10 years ago Closed 9 years ago

jsd_NewSourceText leaks new_url_string ifndef LIVEWIRE

Categories

(Core :: JavaScript Engine, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla5

People

(Reporter: timeless, Assigned: timeless)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, memory-leak)

Attachments

(1 file)

2.54 KB, patch
jorendorff
: review+
beltzner
: approval2.0-
Details | Diff | Splinter Review
378  	jsd_NewSourceText(JSDContext* jsdc, const char* url)

381  	    const char* new_url_string;

385  	#ifdef LIVEWIRE
386  	    new_url_string = url; /* we take ownership of alloc'd string */
387  	#else
388  	    new_url_string = jsd_BuildNormalizedURL(url);
389  	#endif

393  	    jsdsrc = jsd_FindSourceForURL(jsdc, new_url_string);

395  	    if( jsdsrc )
396  	    {
397  	        if( jsdsrc->doingEval )
398  	        {
399  	#ifdef LIVEWIRE
400  	            free((char*)new_url_string);
401  	#endif
402  	            JSD_UNLOCK_SOURCE_TEXT(jsdc);
leak:
403  	            return NULL;
404  	        }

this arranges to unconditioally free new_url_string:
409  	    jsdsrc = _addSource( jsdc, new_url_string );
Attached patch patchSplinter Review
Assignee: nobody → timeless
Status: NEW → ASSIGNED
Attachment #465336 - Flags: review?(cbiesinger)
Attachment #465336 - Flags: approval2.0?
Comment on attachment 465336 [details] [diff] [review]
patch

I don't think I'm a good person for this review, sorry.
Attachment #465336 - Flags: review?(cbiesinger)
Attachment #465336 - Flags: review?(jorendorff)
Attachment #465336 - Flags: approval2.0?
Attachment #465336 - Flags: review?(jorendorff) → review+
Attachment #465336 - Flags: approval2.0?
Comment on attachment 465336 [details] [diff] [review]
patch

Can we make sure this hasn't bitrotted? Then renominate for approval.
Attachment #465336 - Flags: approval2.0? → approval2.0-
http://hg.mozilla.org/mozilla-central/rev/473318f3853a
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.2
Component: JavaScript Debugging/Profiling APIs → JavaScript Engine
You need to log in before you can comment on or make changes to this bug.