Repository: incubator-hawq Updated Branches: refs/heads/master 513388129 -> 7920ad4ec
HAWQ-980. hawq does not handle guc value with space properly Remove and replace some thread-unsafe functions in addOneOption(). Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/7920ad4e Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/7920ad4e Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/7920ad4e Branch: refs/heads/master Commit: 7920ad4ecb14a4845b6f09646e0fc7cdb6304ea7 Parents: 5133881 Author: Paul Guo <[email protected]> Authored: Mon Aug 15 13:36:30 2016 +0800 Committer: ivan <[email protected]> Committed: Tue Aug 16 10:00:25 2016 +0800 ---------------------------------------------------------------------- src/backend/cdb/executormgr.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/7920ad4e/src/backend/cdb/executormgr.c ---------------------------------------------------------------------- diff --git a/src/backend/cdb/executormgr.c b/src/backend/cdb/executormgr.c index e35f10b..f8efb3d 100644 --- a/src/backend/cdb/executormgr.c +++ b/src/backend/cdb/executormgr.c @@ -868,11 +868,9 @@ addOneOption(PQExpBufferData *buffer, struct config_generic * guc) char *temp, *new_temp; size = 256; - temp = palloc(size + 8); + temp = malloc(size + 8); if (temp == NULL) - ereport(ERROR, - (errcode(ERRCODE_OUT_OF_MEMORY), - errmsg("out of memory"))); + return false; j = 0; for (start = 0; start < strlen(str); ++start) @@ -880,11 +878,12 @@ addOneOption(PQExpBufferData *buffer, struct config_generic * guc) if (j == size) { size *= 2; - new_temp = repalloc(temp, size + 8); + new_temp = realloc(temp, size + 8); if (new_temp == NULL) - ereport(ERROR, - (errcode(ERRCODE_OUT_OF_MEMORY), - errmsg("out of memory"))); + { + free(temp); + return false; + } temp = new_temp; } @@ -900,7 +899,7 @@ addOneOption(PQExpBufferData *buffer, struct config_generic * guc) temp[j] = '\0'; appendPQExpBuffer(buffer, " -c %s=%s", guc->name, temp); - pfree(temp); + free(temp); return true; }
