Closed Bug 1263872 Opened 4 years ago Closed 4 years ago

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

Categories

(Core :: Audio/Video, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
Tracking Status
firefox48 --- affected

People

(Reporter: andi, Assigned: andi)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, Whiteboard: CID 1358453 )

Attachments

(1 file)

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.
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
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
Closed: 4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.