]> granicus.if.org Git - pgbouncer/commitdiff
Avoid double-free in parse_filename
authorDaniel Gustafsson <dgustafsson@pivotal.io>
Thu, 7 Jun 2018 20:59:53 +0000 (22:59 +0200)
committerDaniel Gustafsson <dgustafsson@pivotal.io>
Thu, 7 Jun 2018 20:59:53 +0000 (22:59 +0200)
If the fopen() call fails parse_namefile() frees the filename buffer
fn, and the caller does the same. Avoid freeing in parse_namefile()
and leave the cleanup to the caller.

src/hba.c

index 5cc3d08eaf89346cb2db2f869aa056d4296c0c8f..ca29ea3bcf79c81515de504c558f175c69f34333 100644 (file)
--- a/src/hba.c
+++ b/src/hba.c
@@ -359,7 +359,6 @@ static bool parse_namefile(struct HBAName *hname, const char *fn, bool is_db)
 
        f = fopen(fn, "r");
        if (!f) {
-               free(fn);
                return false;
        }
        for (linenr = 1; ; linenr++) {