[PATCH] Fix NULL checking in check_TSCurrentConfig()
The correct NULL check should use `*newval'; `newval' must be non-null.
---
src/backend/utils/cache/ts_cache.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/backend/utils/cache/ts_cache.c b/src/backend/utils/cache/ts_cache.c
index e688b1a..65a8ad7 100644
--- a/src/backend/utils/cache/ts_cache.c
+++ b/src/backend/utils/cache/ts_cache.c
@@ -642,7 +642,7 @@ check_TSCurrentConfig(char **newval, void **extra, GucSource source)
free(*newval);
*newval = strdup(buf);
pfree(buf);
- if (!newval)
+ if (!*newval)
return false;
}
--
1.7.10.4
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
2013/1/20 Xi Wang <xi.wang@gmail.com>:
The correct NULL check should use `*newval'; `newval' must be non-null.
[... cutting code ...]
Please see [1]http://wiki.postgresql.org/wiki/Submitting_a_Patch to know how is our submit patch process.
[1]: http://wiki.postgresql.org/wiki/Submitting_a_Patch
regards,
--
Dickson S. Guedes
mail/xmpp: guedes@guedesoft.net - skype: guediz
http://github.com/guedes - http://guedesoft.net
http://www.postgresql.org.br
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
* Xi Wang (xi.wang@gmail.com) wrote:
The correct NULL check should use `*newval'; `newval' must be non-null.
Why isn't this using pstrdup()..?
Thanks,
Stephen
Stephen Frost <sfrost@snowman.net> writes:
* Xi Wang (xi.wang@gmail.com) wrote:
The correct NULL check should use `*newval'; `newval' must be non-null.
Why isn't this using pstrdup()..?
The GUC API uses malloc, mainly because guc.c can't afford to lose
control on out-of-memory situations.
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Xi Wang <xi.wang@gmail.com> writes:
The correct NULL check should use `*newval'; `newval' must be non-null.
Great catch, will commit. (But first I'm looking through commit
2594cf0e to see if I made the same mistake anywhere else :-(.)
How did you find that, coverity or some such tool?
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
On 1/20/13 10:35 PM, Tom Lane wrote:
Great catch, will commit. (But first I'm looking through commit
2594cf0e to see if I made the same mistake anywhere else :-(.)How did you find that, coverity or some such tool?
Thanks for reviewing the patch.
It was found using a homemade static undefined behavior checker.
- xi
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers