diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2014-11-18 13:28:06 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2014-11-18 13:28:06 -0500 |
commit | 8b13e5c6c0e8a6b797370fb91d207031df5e784a (patch) | |
tree | 4bd1d68bd6f25a7e2d552107fdf0e420f0d07786 /src/bin/pg_dump/parallel.c | |
parent | 606c0123d627b37d5ac3f7c2c97cd715dde7842f (diff) | |
download | postgresql-8b13e5c6c0e8a6b797370fb91d207031df5e784a.tar.gz postgresql-8b13e5c6c0e8a6b797370fb91d207031df5e784a.zip |
Fix some bogus direct uses of realloc().
pg_dump/parallel.c was using realloc() directly with no error check.
While the odds of an actual failure here seem pretty low, Coverity
complains about it, so fix by using pg_realloc() instead.
While looking for other instances, I noticed a couple of places in
psql that hadn't gotten the memo about the availability of pg_realloc.
These aren't bugs, since they did have error checks, but verbosely
inconsistent code is not a good thing.
Back-patch as far as 9.3. 9.2 did not have pg_dump/parallel.c, nor
did it have pg_realloc available in all frontend code.
Diffstat (limited to 'src/bin/pg_dump/parallel.c')
-rw-r--r-- | src/bin/pg_dump/parallel.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bin/pg_dump/parallel.c b/src/bin/pg_dump/parallel.c index 29d20130a96..0a9ac0287a9 100644 --- a/src/bin/pg_dump/parallel.c +++ b/src/bin/pg_dump/parallel.c @@ -1308,7 +1308,7 @@ readMessageFromPipe(int fd) { /* could be any number */ bufsize += 16; - msg = (char *) realloc(msg, bufsize); + msg = (char *) pg_realloc(msg, bufsize); } } @@ -1316,7 +1316,7 @@ readMessageFromPipe(int fd) * Worker has closed the connection, make sure to clean up before return * since we are not returning msg (but did allocate it). */ - free(msg); + pg_free(msg); return NULL; } |