Fix uninitialized scalar and pointer fields. (#166)

This commit is contained in:
Jonathan Hui
2016-06-17 10:01:47 -07:00
committed by GitHub
parent 28d3cc342f
commit a705d15f9b
8 changed files with 25 additions and 3 deletions
+1
View File
@@ -80,6 +80,7 @@ public:
mUriPath = aUriPath;
mHandler = aHandler;
mContext = aContext;
mNext = NULL;
}
private:
+7 -1
View File
@@ -136,7 +136,13 @@ public:
* @param[in] aContext A pointer to arbitrary context information.
*
*/
Timer(Handler aHandler, void *aContext) { mNext = NULL; mHandler = aHandler; mContext = aContext; }
Timer(Handler aHandler, void *aContext) {
mHandler = aHandler;
mContext = aContext;
mT0 = 0;
mDt = 0;
mNext = NULL;
}
/**
* This method returns the start time in milliseconds for the timer.
+3 -2
View File
@@ -294,6 +294,7 @@ public:
IcmpHandler(DstUnreachHandler aDstUnreachHandler, void *aContext) {
mDstUnreachHandler = aDstUnreachHandler;
mContext = aContext;
mNext = NULL;
}
private:
@@ -303,9 +304,9 @@ private:
DstUnreachHandler mDstUnreachHandler;
void *mContext;
IcmpHandler *mNext;
IcmpHandler *mNext;
static IcmpHandler *sHandlers;
static IcmpHandler *sHandlers;
};
/**
+3
View File
@@ -48,8 +48,11 @@ KeyManager::KeyManager(ThreadNetif &aThreadNetif):
mNetif(aThreadNetif)
{
mPreviousKeyValid = false;
mMasterKeyLength = 0;
mMacFrameCounter = 0;
mMleFrameCounter = 0;
mCurrentKeySequence = 0;
mPreviousKeySequence = 0;
}
const uint8_t *KeyManager::GetMasterKey(uint8_t *aKeyLength) const
+7
View File
@@ -68,6 +68,13 @@ MeshForwarder::MeshForwarder(ThreadNetif &aThreadNetif):
mSendBusy = false;
mEnabled = false;
mMessageNextOffset = 0;
mMacSource.mLength = 0;
mMacDest.mLength = 0;
mMeshSource = Mac::kShortAddrInvalid;
mMeshDest = Mac::kShortAddrInvalid;
mAddMeshHeader = false;
mMac.RegisterReceiver(mMacReceiver);
}
+2
View File
@@ -66,6 +66,7 @@ Mle::Mle(ThreadNetif &aThreadNetif) :
ModeTlv::kModeFullNetworkData;
mParentRequestState = kParentIdle;
mParentRequestMode = kMleAttachAnyPartition;
mParentConnectivity = 0;
mTimeout = kMaxNeighborAge;
memset(&mLeaderData, 0, sizeof(mLeaderData));
@@ -209,6 +210,7 @@ ThreadError Mle::BecomeChild(otMleAttachFilter aFilter)
mParentRequestState = kParentRequestStart;
mParentRequestMode = aFilter;
mParentConnectivity = 0;
memset(&mParent, 0, sizeof(mParent));
if (aFilter == kMleAttachAnyPartition)
+1
View File
@@ -67,6 +67,7 @@ MleRouter::MleRouter(ThreadNetif &aThreadNetif):
mRouterId = kMaxRouterId;
mPreviousRouterId = kMaxRouterId;
mAdvertiseInterval = kAdvertiseIntervalMin;
mRouterIdSequenceLastUpdated = 0;
mCoapMessageId = otPlatRandomGet();
}
+1
View File
@@ -48,6 +48,7 @@ Local::Local(ThreadNetif &aThreadNetif):
NetworkData(),
mMle(aThreadNetif.GetMle())
{
mCoapMessageId = 0;
}
ThreadError Local::AddOnMeshPrefix(const uint8_t *aPrefix, uint8_t aPrefixLength, int8_t aPrf,