summaryrefslogtreecommitdiff
path: root/src/test/regress
diff options
context:
space:
mode:
authorStephen Frost2014-03-03 08:18:51 +0000
committerStephen Frost2014-03-03 08:18:51 +0000
commit5592ebac55460866da867df5c783c34e3c9a7cae (patch)
treea7792bd0189203b5f8acb33d1b312e9baaece5fb /src/test/regress
parentb1aebbb6a86e96d7b8f3035ac730dfc24652496c (diff)
Another round of Coverity fixes
Additional non-security issues/improvements spotted by Coverity. In backend/libpq, no sense trying to protect against port->hba being NULL after we've already dereferenced it in the switch() statement. Prevent against possible overflow due to 32bit arithmitic in basebackup throttling (not yet released, so no security concern). Remove nonsensical check of array pointer against NULL in procarray.c, looks to be a holdover from 9.1 and earlier when there were pointers being used but now it's just an array. Remove pointer check-against-NULL in tsearch/spell.c as we had already dereferenced it above (in the strcmp()). Remove dead code from adt/orderedsetaggs.c, isnull is checked immediately after each tuplesort_getdatum() call and if true we return, so no point checking it again down at the bottom. Remove recently added minor error-condition memory leak in pg_regress.
Diffstat (limited to 'src/test/regress')
-rw-r--r--src/test/regress/pg_regress.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c
index 541ce8b33d3..438b95fe59a 100644
--- a/src/test/regress/pg_regress.c
+++ b/src/test/regress/pg_regress.c
@@ -1154,11 +1154,17 @@ get_alternative_expectfile(const char *expectfile, int i)
{
char *last_dot;
int ssize = strlen(expectfile) + 2 + 1;
- char *tmp = (char *) malloc(ssize);
- char *s = (char *) malloc(ssize);
+ char *tmp;
+ char *s;
- if (!tmp || !s)
+ if (!(tmp = (char*) malloc(ssize)))
return NULL;
+
+ if (!(s = (char*) malloc(ssize)))
+ {
+ free(tmp);
+ return NULL;
+ }
strcpy(tmp, expectfile);
last_dot = strrchr(tmp, '.');