valgrind warnings writing uninitialized memory to disk cache

RESOLVED FIXED

Status

()

RESOLVED FIXED
12 years ago
11 years ago

People

(Reporter: dbaron, Assigned: dbaron)

Tracking

({valgrind})

Trunk
x86
Linux
valgrind
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [patch])

Attachments

(1 attachment)

I originally reopened bug 184614 for this, but I'm filing it now as a separate bug.

On startup, I reliably see a valgrind warning about writing uninitialized memory to disk cache.  One of those warnings is in attachment 252679 [details].

I noticed the problem may be to the effect of mKeyStart on sizeof(nsDiskCacheEntry).
In particular, the sizeof(nsDiskCacheEntry) math in CreateDiskCacheEntry, which could use the offsetof trick that nsDiskCacheEntry::Size uses, or we could just get rid of mKeyStart, which is pretty easy as well.
Created attachment 252691 [details] [diff] [review]
patch

This removes the mKeyStart (which presumably adds 3 bytes of padding for the alignment as well), so that sizeof(nsDiskCacheEntry) is less confusing.  The substantive change this should be causing is reducing the size calculation in CreateDiskCacheEntry, which does two things:
 * reduces the amount of memory allocated
 * reduces the |size| returned to nsDiskCacheMap::WriteDiskCacheEntry

The latter change changes the file index; therefore I chose to bump the cache version, although I'm not sure if that's needed.
Assignee: nobody → dbaron
Status: NEW → ASSIGNED
Attachment #252691 - Flags: superreview?
Attachment #252691 - Flags: review?

Updated

12 years ago
Attachment #252691 - Flags: superreview?(darin.moz)
Attachment #252691 - Flags: superreview+
Attachment #252691 - Flags: review?(darin.moz)
Attachment #252691 - Flags: review+
Checked in to trunk.
Status: ASSIGNED → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → FIXED
Keywords: valgrind
You need to log in before you can comment on or make changes to this bug.