Note: There are a few cases of duplicates in user autocompletion which are being worked on.

possible memory leak in WebM reader

RESOLVED FIXED in mozilla8

Status

()

Core
Audio/Video
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: David Volgyes, Assigned: kinetik)

Tracking

(Blocks: 1 bug)

Trunk
mozilla8
All
Other
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 2 obsolete attachments)

(Reporter)

Description

6 years ago
Created attachment 547436 [details] [diff] [review]
patch with my proposed solution

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0
Build ID: 20110622232440

Steps to reproduce:

I tested the code with cppcheck 1.49,
and I checked some warning from the result.



Actual results:

Cppcheck showed several warnings, but some of them false positive.
This seems a real bug:
content/media/webm/nsWebMReader.cpp:498]: (error) Memory leak: buffer

The code allocates memory for temporary storage.
However, it does not release the memory when error happens.




Expected results:

- Memory should be released before "return". 
(A possible fix is attached, but please, review it before use.)
- Mozilla should use cppcheck for automated testing.
Component: General → Video/Audio
Product: Firefox → Core
QA Contact: general → video.audio
Nice catch! Please make |buffer| an nsAutoArrayPtr<SoundDataValue>, so that it's automatically released on scope exit instead. You'll need to call buffer.forget() when you pass it to the SoundData constructor, as that takes over ownership.
(Assignee)

Comment 2

6 years ago
Created attachment 549287 [details] [diff] [review]
patch v0
Assignee: nobody → kinetik
Attachment #547436 - Attachment is obsolete: true
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #549287 - Flags: review?(chris)
(Assignee)

Comment 3

6 years ago
Comment on attachment 549287 [details] [diff] [review]
patch v0

Oops, this is missing a buffer.forget() in once place.
Attachment #549287 - Flags: review?(chris)
(Assignee)

Comment 4

6 years ago
Created attachment 549288 [details] [diff] [review]
patch v1
Attachment #549287 - Attachment is obsolete: true
Attachment #549288 - Flags: review?(chris)
Comment on attachment 549288 [details] [diff] [review]
patch v1

Review of attachment 549288 [details] [diff] [review]:
-----------------------------------------------------------------
Attachment #549288 - Flags: review?(chris) → review+
(Assignee)

Updated

6 years ago
Whiteboard: [inbound]
http://hg.mozilla.org/mozilla-central/rev/a7260d755392
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Whiteboard: [inbound]
Target Milestone: --- → mozilla8

Updated

6 years ago
Blocks: 679417
You need to log in before you can comment on or make changes to this bug.