Closed Bug 1366882 Opened 3 years ago Closed 3 years ago

Fix some resource leaks

Categories

(Firefox Build System :: Source Code Analysis, enhancement)

enhancement
Not set

Tracking

(firefox-esr52 wontfix, firefox53 wontfix, firefox54 wontfix, firefox55 fixed)

RESOLVED FIXED
mozilla55
Tracking Status
firefox-esr52 --- wontfix
firefox53 --- wontfix
firefox54 --- wontfix
firefox55 --- fixed

People

(Reporter: Sylvestre, Assigned: Sylvestre)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, memory-leak, Whiteboard: [CID 1213977][CID 1401664][CID 1401662][CID 1401661][CID 1402588])

Attachments

(4 files)

No description provided.
Assignee: nobody → sledru
Keywords: mlk
Comment on attachment 8870172 [details]
hg logBug 1366882 - fix resource leaks CID 1401664 1401662 1401661

https://reviewboard.mozilla.org/r/141612/#review145286

This works, but it would be even better if you changed each |pb| to a |UniquePtr<ProfileBuffer>|, and then the explicit |delete| statements wouldn't be necessary. r=me with that. Thanks!
Attachment #8870172 - Flags: review?(n.nethercote) → review+
Comment on attachment 8870170 [details]
Bug 1366882 - Fix a resource leak - CID 1402588

https://reviewboard.mozilla.org/r/141608/#review145292

::: extensions/auth/nsHttpNegotiateAuth.cpp:548
(Diff revision 1)
>          //
>          nsresult rv =
>              Base64Decode(challenge, len, (char**)&inToken, &inTokenLen);
>  
>          if (NS_FAILED(rv)) {
> +            free(inToken);

In the failed case `inToken` can point to invalid memory, we don't want to free it. `Base64Decode` will only set the buffer on success [1].

[1] http://searchfox.org/mozilla-central/rev/6c2dbacbba1d58b8679cee700fd0a54189e0cf1b/xpcom/io/Base64.cpp#439
Attachment #8870170 - Flags: review?(erahm) → review-
Comment on attachment 8870171 [details]
Bug 1366882 - Fix a resource leak - CID 1213977 -

https://reviewboard.mozilla.org/r/141610/#review145520
Attachment #8870171 - Flags: review?(nfroyd) → review+
Comment on attachment 8870170 [details]
Bug 1366882 - Fix a resource leak - CID 1402588

https://reviewboard.mozilla.org/r/141608/#review146106

Looks good.
Attachment #8870170 - Flags: review?(erahm) → review+
Comment on attachment 8870178 [details]
Bug 1366882 - Fix a resource leak - CID 221217 -

https://reviewboard.mozilla.org/r/141618/#review150876
Attachment #8870178 - Flags: review?(ted) → review+
Pushed by sledru@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/021d3649e2fc
Fix a resource leak - CID 1402588 r=erahm
https://hg.mozilla.org/integration/autoland/rev/365687db6288
Fix a resource leak - CID 1213977 - r=froydnj
https://hg.mozilla.org/integration/autoland/rev/2ec004b70daa
hg logBug 1366882 - fix resource leaks CID 1401664 1401662 1401661 r=njn
https://hg.mozilla.org/integration/autoland/rev/4b380c4484ba
Fix a resource leak - CID 221217 - r=ted
https://hg.mozilla.org/mozilla-central/rev/2ec004b70daa
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.