Use MEM_CONTEXT_NEW_BEGIN() block.
This pattern makes more sense.  The prior code was probably copy-pasted from code with slightly different requirements.
@@ -34,12 +34,10 @@ userInitInternal(void)
MEM_CONTEXT_BEGIN(memContextTop())
{
- userLocalData.memContext = memContextNew("UserLocalData");
- }
- MEM_CONTEXT_END();
-
- MEM_CONTEXT_BEGIN(userLocalData.memContext)
+ MEM_CONTEXT_NEW_BEGIN("UserLocalData")
{
+ userLocalData.memContext = MEM_CONTEXT_NEW();
+
userLocalData.userId = getuid();
userLocalData.userName = userNameFromId(userLocalData.userId);
userLocalData.userRoot = userLocalData.userId == 0;
@@ -47,6 +45,8 @@ userInitInternal(void)
userLocalData.groupId = getgid();
userLocalData.groupName = groupNameFromId(userLocalData.groupId);
}
+ MEM_CONTEXT_NEW_END();
+ }
MEM_CONTEXT_END();
FUNCTION_TEST_RETURN_VOID();
