Fix a leak in HashStore.cpp debug logging
Categories
(Toolkit :: Safe Browsing, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox162 | --- | fixed |
People
(Reporter: Sylvestre, Assigned: ffayyaz, Mentored)
References
(Blocks 1 open bug)
Details
(Keywords: good-first-bug, Whiteboard: [lang=c++])
Attachments
(1 external file)
Filing as a good first bug to learn workflows.
Inside if (aSize <= 4 && LOG_ENABLED()), the buffer returned by ToNewCString(aPrefixes) is never freed. Use aPrefixes.BeginReading() directly instead of allocating a copy (or free it with free() after logging).
Current code:
const uint32_t* p =
reinterpret_cast<const uint32_t*>(ToNewCString(aPrefixes));
Link to the code:
https://searchfox.org/firefox-main/source/toolkit/components/url-classifier/HashStore.cpp
To verify the fix:
./mach build
./mach gtest 'UrlClassifier*'
This was reported by Coverity Scan (CID 1434927). The analyzer will stop reporting it once the change lands.
Tutorial to contribute:
https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
https://firefox-source-docs.mozilla.org/contributing/stack_quickref.html
Please don't ask for the bug to be assigned. It will be automatically assigned to the first patch.
| Assignee | ||
Updated•2 days ago
|
| Assignee | ||
Comment 1•2 days ago
|
||
Comment 3•1 day ago
|
||
| bugherder | ||
Description
•