HAWQ-524. Modify processing for cdbDispatchResult->resultBuf when creation and free
Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/ac26f48f Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/ac26f48f Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/ac26f48f Branch: refs/heads/HAWQ-459 Commit: ac26f48fd44af17c26cee0ce48a44bf50ddeb9ca Parents: 4b53168 Author: Lili Ma <[email protected]> Authored: Mon Mar 14 17:47:42 2016 +0800 Committer: Lili Ma <[email protected]> Committed: Tue Mar 15 09:38:40 2016 +0800 ---------------------------------------------------------------------- src/backend/cdb/cdbdispatchresult.c | 19 +++++++++++-------- src/backend/cdb/executormgr.c | 4 +++- 2 files changed, 14 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/ac26f48f/src/backend/cdb/cdbdispatchresult.c ---------------------------------------------------------------------- diff --git a/src/backend/cdb/cdbdispatchresult.c b/src/backend/cdb/cdbdispatchresult.c index b036b26..9ba90c0 100644 --- a/src/backend/cdb/cdbdispatchresult.c +++ b/src/backend/cdb/cdbdispatchresult.c @@ -183,15 +183,18 @@ void cdbdisp_resetResult(CdbDispatchResult *dispatchResult) { PQExpBuffer buf = dispatchResult->resultbuf; - PGresult **begp = (PGresult **)buf->data; - PGresult **endp = (PGresult **)(buf->data + buf->len); - PGresult **p; - - /* Free the PGresult objects. */ - for (p = begp; p < endp; ++p) + if (buf != NULL) { - Assert(*p != NULL); - PQclear(*p); + PGresult **begp = (PGresult **)buf->data; + PGresult **endp = (PGresult **)(buf->data + buf->len); + PGresult **p; + + /* Free the PGresult objects. */ + for (p = begp; p < endp; ++p) + { + Assert(*p != NULL); + PQclear(*p); + } } /* Reset summary indicators. */ http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/ac26f48f/src/backend/cdb/executormgr.c ---------------------------------------------------------------------- diff --git a/src/backend/cdb/executormgr.c b/src/backend/cdb/executormgr.c index 88dd32f..47f5bbe 100644 --- a/src/backend/cdb/executormgr.c +++ b/src/backend/cdb/executormgr.c @@ -220,7 +220,9 @@ executormgr_bind_executor_task(struct DispatchData *data, executor->refResult = cdbdisp_makeResult(dispatch_get_results(data), executor->desc, dispatch_get_task_identity(task)->slice_id); - Assert(executor->refResult != NULL); + + if (executor->refResult == NULL) + return false; /* Transfer any connection errors from segdbDesc. */ executormgr_merge_error(executor);
