From: Daniel Gustafsson Date: Thu, 7 Jun 2018 21:04:29 +0000 (+0200) Subject: Avoid NULL pointer deref in parse_line X-Git-Tag: pgbouncer_1_9_0~32^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8f1df083e38727e9a407e6119f02f80b37425dfa;p=pgbouncer Avoid NULL pointer deref in parse_line If we fail to calloc the rule buffer, going to failed: will deref rule via the rule_free() call. Avoid by returning false directly and bypass the failed: block. --- diff --git a/src/hba.c b/src/hba.c index ca29ea3..100edf6 100644 --- a/src/hba.c +++ b/src/hba.c @@ -524,7 +524,7 @@ static bool parse_line(struct HBA *hba, struct TokParser *tp, int linenr, const rule = calloc(sizeof *rule, 1); if (!rule) { log_warning("hba: no mem for rule"); - goto failed; + return false; } rule->rule_type = rtype;