Closed Bug 1373250 Opened 7 years ago Closed 7 years ago

Intermittent LeakSanitizer | leak at AllocateStringCopy, ToNewCString, pref_savePrefs, mozilla::Preferences::WritePrefFile

Categories

(Core :: Preferences: Backend, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: intermittent-bug-filer, Assigned: benjamin)

References

Details

(Keywords: intermittent-failure)

Attachments

(2 files)

Flags: needinfo?(milan)
Assignee: nobody → milan
Right, not properly freeing the memory when a new write request comes in before the old one is handled. That would account for the intermittency. Patch coming.
Comment on attachment 8878046 [details] Bug 1373250: encapsulate all of the memory management in a single structure so that we don't have to do any manual freeing. https://reviewboard.mozilla.org/r/149464/#review154054 Ugh, I didn't realize the weird memory management here between the UniquePtr and the contents. I've put up an alternate version which unifies the memory and I think is easier to read. Please let me know if you agree!
Attachment #8878046 - Flags: review?(benjamin) → review-
Comment on attachment 8878083 [details] Bug 1373250 alternate version: encapsulate all of the memory management in a single structure so that we don't have to do any manual freeing. https://reviewboard.mozilla.org/r/149494/#review154078 ::: modules/libpref/Preferences.cpp:289 (Diff revision 1) > - char*& pref = aPrefs[valueIdx]; > + char* pref = prefptr.get(); > MOZ_ASSERT(pref); > outStream->Write(pref, strlen(pref), &writeAmount); > outStream->Write(NS_LINEBREAK, NS_LINEBREAK_LEN, &writeAmount); > - free(pref); > pref = nullptr; We don't need this line now, right?
Attachment #8878083 - Flags: review?(milan) → review+
Attachment #8878046 - Attachment is obsolete: true
Flags: needinfo?(milan)
Assignee: milan → benjamin
(In reply to Benjamin Smedberg [:bsmedberg] from comment #4) > Comment on attachment 8878046 [details] > Bug 1373250: Properly free the strings from abandoned pref write. > > https://reviewboard.mozilla.org/r/149464/#review154054 > > Ugh, I didn't realize the weird memory management here between the UniquePtr > and the contents. I've put up an alternate version which unifies the memory > and I think is easier to read. Please let me know if you agree! Pushed to try.
Comment on attachment 8878046 [details] Bug 1373250: encapsulate all of the memory management in a single structure so that we don't have to do any manual freeing. https://reviewboard.mozilla.org/r/149464/#review154150
The patches really got confusing at this point; the I just pushed is Benjamin's version with a build problem fixed, and a review comment addressed. It's on try here: https://treeherder.mozilla.org/#/jobs?repo=try&revision=1cc67dba7d31
Comment on attachment 8878046 [details] Bug 1373250: encapsulate all of the memory management in a single structure so that we don't have to do any manual freeing. https://reviewboard.mozilla.org/r/149464/#review154152
Attachment #8878046 - Flags: review?(milan) → review+
Pushed by msreckovic@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/04baace29a6c encapsulate all of the memory management in a single structure so that we don't have to do any manual freeing. r=milan
(In reply to Pulsebot from comment #12) > Pushed by msreckovic@mozilla.com: > https://hg.mozilla.org/integration/autoland/rev/04baace29a6c > encapsulate all of the memory management in a single structure so that we > don't have to do any manual freeing. r=milan Just to be clear, this is Benjamin's patch, with a build failure fixed and the try above.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: