提交 5c56b5cc 编写于 作者: M Marbin Tan

Fix memory and resource leaks detected by valgrind

上级 8262c644
{
<Supressing exit>
<Supressing exit: rhel gp_dump>
Memcheck:Free
fun:free
obj:/lib64/libc-2.5.so
obj:/lib64/libc-2.5.so
obj:/lib64/libc-2.11.3.so
fun:_vgnU_freeres
fun:exit
fun:main
}
{
<Suppress exit>
<Suppress exit: rhel gp_restore>
Memcheck:Free
fun:free
obj:/lib64/libc-2.5.so
obj:/lib64/libc-2.5.so
obj:/lib64/libc-2.11.3.so
fun:_vgnU_freeres
fun:exit
fun:(below main)
}
{
<Suppress exit: suse gp_dump>
Memcheck:Free
fun:free
fun:free_mem
fun:__libc_freeres
fun:_vgnU_freeres
fun:__run_exit_handlers
fun:exit
fun:main
}
{
<Suppress exit: suse gp_restore>
Memcheck:Free
fun:free
fun:free_mem
fun:__libc_freeres
fun:_vgnU_freeres
fun:__run_exit_handlers
fun:exit
fun:(below main)
}
......@@ -52,7 +52,7 @@ AddNotificationtoBackupStateMachine(BackupStateMachine * pStateMachine, PGnotify
}
/* CleanupNotifications: Frees the PGnotify * objects in the internal array, and resets the array count to 0.
* Does NOT deallocate the array memory, as it wiull be reused.
* Does NOT deallocate the array memory, as it will be reused.
*/
void
CleanupNotifications(BackupStateMachine *pStateMachine)
......@@ -140,6 +140,12 @@ DestroyBackupStateMachine(BackupStateMachine *pStateMachine)
free(pStateMachine->ppNotifyAr);
}
if (pStateMachine->pszNotifyRelNameMasterProbe != NULL)
free(pStateMachine->pszNotifyRelNameMasterProbe);
if (pStateMachine->pszNotifyRelNameSegmentProbe != NULL)
free(pStateMachine->pszNotifyRelNameSegmentProbe);
free(pStateMachine);
}
......
......@@ -608,7 +608,6 @@ startTransactionAndLock(PGconn *pMasterConn)
* when COMMIT is run.
*/
mpp_msg(logInfo, progname, "Getting a lock on pg_class in database %s.\n", pMasterConn->dbName);
pQry = createPQExpBuffer();
appendPQExpBuffer(pQry, "LOCK TABLE pg_catalog.pg_class IN EXCLUSIVE MODE;");
pRes = PQexec(pMasterConn, pQry->data);
if (pRes == NULL)
......
......@@ -429,6 +429,7 @@ MakeString(const char *fmt,...)
nBytes *= 2;
pszNew = (char *) realloc(pszRtn, nBytes);
if (pszNew == NULL)
{
free(pszRtn);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册