From: Marko Kreen Date: Fri, 4 Dec 2015 12:55:03 +0000 (+0200) Subject: hba: initialize struct before opening file X-Git-Tag: pgbouncer_1_7~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=be28f027302064155eab81a05ebfb45c5a9c629e;p=pgbouncer hba: initialize struct before opening file Otherwise is can crash when walking uninitialized list. Fixes: #95 --- diff --git a/src/hba.c b/src/hba.c index 322b7d0..dade1d8 100644 --- a/src/hba.c +++ b/src/hba.c @@ -617,11 +617,12 @@ struct HBA *hba_load_rules(const char *fn) if (!hba) goto out; + list_init(&hba->rules); + f = fopen(fn, "r"); if (!f) goto out; - list_init(&hba->rules); for (linenr = 1; ; linenr++) { len = getline(&ln, &lnbuf, f); if (len < 0)