[Static Analysis][Resource leak] In function dump(...) from test_resampler.cpp

RESOLVED FIXED

Status

()

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

People

(Reporter: andi, Assigned: andi)

Tracking

(Blocks: 1 bug, {coverity})

Trunk
coverity
Points:
---

Firefox Tracking Flags

(firefox48 affected)

Details

(Whiteboard: CID 1358453 )

MozReview Requests

()

Submitter Diff Changes Open Issues Last Updated
Loading...
Error loading review requests:

Attachments

(1 attachment)

(Assignee)

Description

2 years ago
The Static Analysis tool Coverity added variable |file| leaks memory when fwrite fails:

>>  if (count != fwrite(frames, sizeof(T), count, file)) {
>>    fprintf(stderr, "error writing to %s\n", name);
>>    return;
>>  }

|file| should be closed no matter the outcome of fwrite.
(Assignee)

Comment 1

2 years ago
Created attachment 8740364 [details]
MozReview Request: Bug 1263872 - prevent memory leak by closing |file|. r?cpearce

Review commit: https://reviewboard.mozilla.org/r/45737/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/45737/
Attachment #8740364 - Flags: review?(cpearce)
Thanks, this is upstream code, and we are going to update the version used in mozilla-central soon.

I've pushed a variation of your patch for you upstream [0], we prefer to always use the curly braces, even for one line if().

[0]: https://github.com/kinetiknz/cubeb/commit/86aa9cb8e5152361b55f3207ffae5e0e6b1f1b4f
(Assignee)

Comment 3

2 years ago
thanks
Comment on attachment 8740364 [details]
MozReview Request: Bug 1263872 - prevent memory leak by closing |file|. r?cpearce

libcubeb changes should be reviewed by kinetik.
Attachment #8740364 - Flags: review?(cpearce) → review?(kinetik)
Attachment #8740364 - Flags: review?(kinetik) → review+
Fix landed in bug 1264594.

Thanks!
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.