From 4402f8f8e55b856fc8ccac5c67cc94e097d75ab8 Mon Sep 17 00:00:00 2001 From: Daniel Gustafsson Date: Fri, 16 Dec 2016 23:22:11 +0100 Subject: [PATCH] Remove pointless NULL check At this point we already know that pQry is non-NULL as we have dereferenced it previous in the function. Remove useless check to make the code clearer. Per gripe by Coverity. --- src/bin/pg_dump/cdb/cdb_seginst.c | 6 ++---- src/bin/pg_dump/cdb/cdb_table.c | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/bin/pg_dump/cdb/cdb_seginst.c b/src/bin/pg_dump/cdb/cdb_seginst.c index 926a84ee31..94cbeb4b21 100644 --- a/src/bin/pg_dump/cdb/cdb_seginst.c +++ b/src/bin/pg_dump/cdb/cdb_seginst.c @@ -270,8 +270,7 @@ GetDumpSegmentDatabaseArray(PGconn *pConn, pSegDBAr->count = x; cleanup: - if (pQry != NULL) - destroyPQExpBuffer(pQry); + destroyPQExpBuffer(pQry); if (pRes != NULL) PQclear(pRes); @@ -465,8 +464,7 @@ GetRestoreSegmentDatabaseArray(PGconn *pConn, restorePairAr->count = x; cleanup: - if (pQry != NULL) - destroyPQExpBuffer(pQry); + destroyPQExpBuffer(pQry); if (pRes != NULL) PQclear(pRes); diff --git a/src/bin/pg_dump/cdb/cdb_table.c b/src/bin/pg_dump/cdb/cdb_table.c index 19a941eddb..6b04813634 100644 --- a/src/bin/pg_dump/cdb/cdb_table.c +++ b/src/bin/pg_dump/cdb/cdb_table.c @@ -155,8 +155,7 @@ GetCDBBaseTableArray(PGconn *pConn, CDBBaseTableArray *pTableAr) cleanup: if (pRes != NULL) PQclear(pRes); - if (pQry != NULL) - destroyPQExpBuffer(pQry); + destroyPQExpBuffer(pQry); return bRtn; } @@ -249,8 +248,7 @@ GetCDBSegmentInstanceArray(PGconn *pConn, const char *pszDBName, CDBSegmentInsta cleanup: if (pRes != NULL) PQclear(pRes); - if (pQry != NULL) - destroyPQExpBuffer(pQry); + destroyPQExpBuffer(pQry); return bRtn; } -- GitLab