Closed danielgustafsson closed 2 years ago
Hi @danielgustafsson ; thanks for your contribution!
Can you have a look at using ALLOCATION_FAILED_ERROR instead of the error format you've been using here? It's already used in a couple places: https://github.com/citusdata/pg_auto_failover/search?q=ALLOCATION_FAILED_ERROR&type=code.
Hi @danielgustafsson ; thanks for your contribution!
Can you have a look at using ALLOCATION_FAILED_ERROR instead of the error format you've been using here? It's already used in a couple places: https://github.com/citusdata/pg_auto_failover/search?q=ALLOCATION_FAILED_ERROR&type=code.
Oh nice, that's a much bette fit. I'll fix that in a rebase which also handles the silly typo I fat-fingered in.
Sorry about that, I missed it before. For clarity, I think I would prefer using value == NULL
rather than !value
in the tests. What do you think? I like code better when it's obvious, and == NULL
can't be more obvious, I believe...
Sorry about that, I missed it before. For clarity, I think I would prefer using
value == NULL
rather than!value
in the tests. What do you think? I like code better when it's obvious, and== NULL
can't be more obvious, I believe...
I don't have strong opinions either way, so I've updated to patch to your preference.
Thanks!
Albeit unlikely on modern server systems, memory allocation can still fail and the result, if unchecked, be null pointer dereferences. This adds a check to affected callsites of strdup to ensure allocation was successful, or abort if not.