Closed Bug 351739 Opened 18 years ago Closed 18 years ago

Memory leak in |JS_dtobasestr| (jsdtoa.c)

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: kherron+mozilla, Assigned: sciguyryan)

References

(Blocks 1 open bug, )

Details

(Keywords: coverity, fixed1.8.0.10, fixed1.8.1.2)

Attachments

(1 file, 3 obsolete files)

This is coverity ID 68. Please see the sample URL. The allocation at line 2928 is leaked if the call to |d2b| or |lshift| return null.
Check NSPR's prdtoa.c. The JS version forked long ago from David M. Gay's netlib hosted dtoa.c, and I think NSPR refreshed more recently. /be
NSPR's prdtoa.c doesn't have the equivalent of the JS_dtobasestr function.
Attached patch Patch v1 (obsolete) (deleted) — Splinter Review
Patch v1. Simply use |free(buffer)| before the function returns.
Assignee: general → sciguyryan+bugzilla
Status: NEW → ASSIGNED
Attachment #242217 - Flags: superreview?(brendan)
Attachment #242217 - Flags: review?(brendan)
Same leak around line 3007-ish?
(In reply to comment #4) > Same leak around line 3007-ish? > Certainly looks like it. |buffer| isn't freed before then so I guess your right. I'll update the patch! Thanks for pointing that out :)
Attached patch Patch v1.1 (obsolete) (deleted) — Splinter Review
Updated to add a free for the same leak spotted by Brian Crowder.
Attachment #242217 - Attachment is obsolete: true
Attachment #242222 - Flags: superreview?(brendan)
Attachment #242222 - Flags: review?(brendan)
Attachment #242217 - Flags: superreview?(brendan)
Attachment #242217 - Flags: review?(brendan)
Attachment #242222 - Flags: superreview?(brendan)
Attachment #242222 - Flags: review?(igor)
Attachment #242222 - Flags: review?(brendan)
Comment on attachment 242222 [details] [diff] [review] Patch v1.1 This is not a pacth against the trunk. Please update it to reflect bug 357392.
Attachment #242222 - Flags: review?(igor)
Attached patch Patch v2.0 (obsolete) (deleted) — Splinter Review
Patch v2.0 * Updated to latest trunk build.
Attachment #242222 - Attachment is obsolete: true
Attachment #251760 - Flags: review?(igor)
Comment on attachment 251760 [details] [diff] [review] Patch v2.0 I will review=+ for the patch with changed order of free and RELEASE_DTOA_LOCK calls to follow LIFO pattern.
Attached patch Patch v2.1 (deleted) — Splinter Review
Patch v2.1 * Same as patch v2.0 but updated to follow the LIFO pattern as suggested by Igor Bukanov.
Attachment #251760 - Attachment is obsolete: true
Attachment #251764 - Flags: review?(igor)
Attachment #251760 - Flags: review?(igor)
Attachment #251764 - Flags: review?(igor) → review+
Whiteboard: [checkin needed]
I committed the patch from comment 10 to the trunk: Checking in jsdtoa.c; /cvsroot/mozilla/js/src/jsdtoa.c,v <-- jsdtoa.c new revision: 3.39; previous revision: 3.38 done Please mark the bug fixed after verifying that the committed code is the right one.
Flags: blocking1.8.1.2?
Flags: blocking1.8.0.10?
Attachment #251764 - Flags: approval1.8.1.2?
Attachment #251764 - Flags: approval1.8.0.10?
Whiteboard: [checkin needed]
Comment on attachment 251764 [details] [diff] [review] Patch v2.1 Approved for both branches, a=jay for drivers.
Attachment #251764 - Flags: approval1.8.1.2?
Attachment #251764 - Flags: approval1.8.1.2+
Attachment #251764 - Flags: approval1.8.0.10?
Attachment #251764 - Flags: approval1.8.0.10+
Flags: blocking1.8.1.2?
Flags: blocking1.8.1.2+
Flags: blocking1.8.0.10?
Flags: blocking1.8.0.10+
Depends on: 357392
I committed the patch from comment 10 to MOZILLA_1_8_0_BRANCH: Checking in jsdtoa.c; /cvsroot/mozilla/js/src/jsdtoa.c,v <-- jsdtoa.c new revision: 3.33.10.3; previous revision: 3.33.10.2 done
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Keywords: fixed1.8.0.10
Resolution: --- → FIXED
I also committed yesterday the patch from comment 10 to MOZILLA_1_8_BRANCH but forgot to update the bug. The committed version was 3.33.2.4.
Keywords: fixed1.8.1.2
Flags: in-testsuite-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: