Closed
Bug 465886
Opened 17 years ago
Closed 14 years ago
TM: realloc is being used incorrectly
Categories
(Core :: JavaScript Engine, defect, P2)
Tracking
()
RESOLVED
WONTFIX
| Tracking | Status | |
|---|---|---|
| fennec | 1.0- | --- |
People
(Reporter: timeless, Assigned: gal)
References
()
Details
(Keywords: crash, memory-leak)
Attachments
(1 file)
|
8.56 KB,
patch
|
Details | Diff | Splinter Review |
if realloc fails, it will return null, leaving the current data unchanged.
correct usage is:
void *x = malloc(1000);
...
void *y = realloc(x, 100000);
if (!y) {
error();
} else {
x = y;
}
also, it'd be nice if you actually handled failure.
| Assignee | ||
Updated•17 years ago
|
Summary: realloc is being used incorrectly → TM: realloc is being used incorrectly
| Assignee | ||
Updated•17 years ago
|
Assignee: general → gal
Severity: critical → major
Flags: blocking1.9.1?
Priority: -- → P3
the JS_Assert call is where i got stuck, it's not meant to be committed, although in a pinch it could go now, it just means that when we fail there, we must kill ourselves (no choice).
i'm told some functions are dead/walking dead, that's ok.
Attachment #349254 -
Flags: review?(gal)
Updated•17 years ago
|
Flags: blocking1.9.1? → blocking1.9.1+
This is just a sanity check... While we're on the subject, when memory is free'ed via free(ptr), is ptr set to NULL/0/null as well. The double free memory problem is almost impossible to debug.
malloc/realloc/free could all be implemented as macros to ensure consistent use of the idioms.
Comment 3•16 years ago
|
||
> While we're on the subject, when memory is free'ed via free(ptr), is ptr set to > NULL/0/null as well.
Is that a question? If so, the answer is "no".
| Assignee | ||
Comment 5•16 years ago
|
||
Not sure this bug needs to block final. Maybe discuss and re-triage? A better fix would be some engine or browser-wide red zone allocation thing (ballast).
Updated•16 years ago
|
tracking-fennec: --- → ?
Flags: blocking1.9.1+
Updated•16 years ago
|
tracking-fennec: ? → 1.0-
Flags: wanted-fennec1.0+
Comment 6•14 years ago
|
||
Obsolete with the removal of tracejit.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → WONTFIX
Updated•13 years ago
|
Attachment #349254 -
Flags: review?(gal)
You need to log in
before you can comment on or make changes to this bug.
Description
•