Closed
Bug 1268387
Opened 10 years ago
Closed 10 years ago
[Static Analysis][Resource leak] In function nsHttpChannel::ForceCacheEntryValidFor
Categories
(Core :: Networking, defect)
Core
Networking
Tracking
()
RESOLVED
FIXED
mozilla49
| Tracking | Status | |
|---|---|---|
| firefox49 | --- | fixed |
People
(Reporter: andi, Assigned: andi)
References
(Blocks 1 open bug)
Details
(Keywords: coverity, Whiteboard: CID 1358787, [necko-active])
Attachments
(1 file)
The Static Analysis tool Coverity added that ToNewCString(key) leaks memory in:
} else {
mCacheEntry->ForceValidFor(aSecondsToTheFuture);
nsAutoCString key;
mCacheEntry->GetKey(key);
LOG(("nsHttpChannel::ForceCacheEntryValidFor successfully forced valid "
"entry with key %s for %d seconds. [this=%p]", ToNewCString(key),
aSecondsToTheFuture, this));
}
This should be fixed by freeing the memory allocated by ToNewCString(key).
| Assignee | ||
Comment 1•10 years ago
|
||
Review commit: https://reviewboard.mozilla.org/r/49423/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/49423/
Attachment #8746424 -
Flags: review?(mcmanus)
Comment 2•10 years ago
|
||
(In reply to Andi-Bogdan Postelnicu from comment #0)
> This should be fixed by freeing the memory allocated by ToNewCString(key).
Can't we just use key.get() instead of allocating?
Whiteboard: CID 1358787 → CID 1358787, [necko-active]
| Assignee | ||
Comment 3•10 years ago
|
||
Comment on attachment 8746424 [details]
MozReview Request: Bug 1268387 - avoid memory leak of ToNewCString(key). r?valentin
Review request updated; see interdiff: https://reviewboard.mozilla.org/r/49423/diff/1-2/
| Assignee | ||
Comment 4•10 years ago
|
||
(In reply to Valentin Gosu [:valentin] from comment #2)
> (In reply to Andi-Bogdan Postelnicu from comment #0)
> > This should be fixed by freeing the memory allocated by ToNewCString(key).
>
> Can't we just use key.get() instead of allocating?
sure why not, just updated the patch.
| Assignee | ||
Comment 5•10 years ago
|
||
Comment on attachment 8746424 [details]
MozReview Request: Bug 1268387 - avoid memory leak of ToNewCString(key). r?valentin
Review request updated; see interdiff: https://reviewboard.mozilla.org/r/49423/diff/2-3/
Attachment #8746424 -
Attachment description: MozReview Request: Bug 1268387 - avoid memory leak of ToNewCString(key). r?mcmanus → MozReview Request: Bug 1268387 - avoid memory leak of ToNewCString(key). r?valentin
Attachment #8746424 -
Flags: review?(mcmanus) → review?(valentin.gosu)
Comment 6•10 years ago
|
||
Comment on attachment 8746424 [details]
MozReview Request: Bug 1268387 - avoid memory leak of ToNewCString(key). r?valentin
https://reviewboard.mozilla.org/r/49423/#review46273
Thanks!
Attachment #8746424 -
Flags: review?(valentin.gosu) → review+
Comment 8•10 years ago
|
||
| bugherder | ||
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in
before you can comment on or make changes to this bug.
Description
•