Open Bug 1111288 Opened 10 years ago Updated 2 years ago

a potential memory leak - caused by forgetting to free after realloc failure

Categories

(Core :: JavaScript Engine, defect)

x86_64
Linux
defect

Tracking

()

UNCONFIRMED

People

(Reporter: yxcynthia, Unassigned)

References

Details

(Keywords: memory-leak)

Attachments

(1 file)

Attached image memory leak target
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36

Steps to reproduce:

run cppcheck on mozilla-central/js/src/editline/editline.c


Actual results:

on line 153: 'screen' nulled but not freed upon failure


Expected results:

the 'screen' should be freed if the 'RENEW' fails, but not handled in the code
Component: Untriaged → JavaScript Engine
Keywords: mlk
Product: Firefox → Core
Blocks: cppcheck
Flags: needinfo?(jorendorff)
I think we can just use moz_xrealloc in RENEW to make this realloc infallible.
> I think we can just use moz_xrealloc in RENEW to make this realloc
> infallible.

Not within Spidermonkey, unfortunately. But we can make RENEW call MOZ_CRASH() on failure.

I'm pretty sure this code is only used in the JS shell, not the browser, which reduces the priority a little.
Assignee: nobody → n.nethercote
Assignee: n.nethercote → nobody
Flags: needinfo?(jorendorff)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: