]> git.ipfire.org Git - people/ms/libloc.git/commitdiff
perl: Close database file after it has been read
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 26 Sep 2019 17:55:54 +0000 (17:55 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 26 Sep 2019 17:55:54 +0000 (17:55 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/perl/Location/Location.xs

index 64a38e2e49cf96131692dea7ab5ad77efc2c5459..04b2e1119eadda40fa0118d12ebaa5c761c5ced7 100644 (file)
@@ -38,6 +38,11 @@ init(file)
                // Parse the database
                struct loc_database* db = NULL;
                err = loc_database_new(ctx, &db, f);
+
+               // We can close the database file straight away
+               // because loc_database_new creates a copy of the file descriptor
+               fclose(f);
+
                if (err) {
                        loc_unref(ctx);