提交 dbbd0d0d 编写于 作者: D Daniel Gustafsson

Ensure that resources are freed before reusing pointers

On the first iteration we know the structs are empty, but when coming
into create_gang_retry we must ensure that they have been freed. Move
to Assertions rather than setting NULL since that's already performed
before returning to the retry label.

Initially per a false positive gripe in Coverity.
上级 c4197be4
......@@ -65,7 +65,7 @@ CreateGangFunc pCreateGangFuncThreaded = createGang_thread;
static Gang *
createGang_thread(GangType type, int gang_id, int size, int content)
{
Gang *newGangDefinition;
Gang *newGangDefinition = NULL;
SegmentDatabaseDescriptor *segdbDesc = NULL;
DoConnectParms *doConnectParmsAr = NULL;
DoConnectParms *pParms = NULL;
......@@ -100,9 +100,12 @@ createGang_thread(GangType type, int gang_id, int size, int content)
initPQExpBuffer(&create_gang_error);
create_gang_retry:
/* If we're in a retry, we may need to reset our initial state, a bit */
newGangDefinition = NULL;
doConnectParmsAr = NULL;
/*
* If we're in a retry, we may need to reset our initial state a bit. We
* also want to ensure that all resources have been released.
*/
Assert(newGangDefinition == NULL);
Assert(doConnectParmsAr == NULL);
successful_connections = 0;
in_recovery_mode_count = 0;
threadCount = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册