Closed Bug 1682204 Opened 5 years ago Closed 5 years ago

arena_t::mId is uninitialised in the constructor

Categories

(Core :: Memory Allocator, task)

task

Tracking

()

RESOLVED FIXED
86 Branch
Tracking Status
firefox86 --- fixed

People

(Reporter: pbone, Assigned: pbone)

Details

Attachments

(1 file)

This is benign because mId is filled in during CreateArena after the constructor is called. But we can patch it to make Covertly happy anyway.

New defect(s) Reported-by: Coverity Scan
Showing 1 of 1 defect(s)

** CID 1470619: Uninitialized members (UNINIT_CTOR)
/memory/build/mozjemalloc.cpp: 3565 in arena_t::arena_t(arena_params_s *,
bool)()


+________________________
*** CID 1470619: Uninitialized members (UNINIT_CTOR)
/memory/build/mozjemalloc.cpp: 3565 in arena_t::arena_t(arena_params_s *,
bool)()
3559 }
3560 MOZ_ASSERT(i == NUM_SMALL_CLASSES - 1);
3561 3562 #if defined(MOZ_DIAGNOSTIC_ASSERT_ENABLED)
3563 mMagic = ARENA_MAGIC;
3564 #endif

CID 1470619: Uninitialized members (UNINIT_CTOR)
Non-static class member "mId" is not initialized in this
constructor nor in any functions that it calls.
3565 }
3566 3567 arena_t::~arena_t() {
3568 size_t i;
3569 MutexAutoLock lock(mLock);
3570 MOZ_RELEASE_ASSERT(!mLink.Left() && !mLink.Right(),

Hi Glandium.

I see this comment here:
https://searchfox.org/mozilla-central/source/memory/build/mozjemalloc.cpp#890

But I'm not sure what it means when we clear mId in the destructor:
https://searchfox.org/mozilla-central/source/memory/build/mozjemalloc.cpp#3589

Maybe it's referring to TypedBaseAlloc<arena_t>'s destructor, but that makes less sense. Should I delete this line of this comment as it seems to not match the code?

Flags: needinfo?(mh+mozilla)
Pushed by pbone@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c0446a031b8e Clear arena_t::mId in the constructor r=glandium
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 86 Branch
Flags: needinfo?(mh+mozilla)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: