]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
location-functions.pl: Add END block to release the database handle.
authorStefan Schantl <stefan.schantl@ipfire.org>
Sat, 7 Nov 2020 18:47:21 +0000 (19:47 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 9 Nov 2020 14:07:00 +0000 (14:07 +0000)
Reference #12515.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/cfgroot/location-functions.pl

index 9b1d0bfb5018e032bce12c733c6b108c4b6f92c2..4837030161c1ed14093837dea2e839c58b0a4c15 100644 (file)
@@ -218,4 +218,14 @@ sub address_has_flags($) {
        return @flags;
 }
 
+# Custom END declaration which will be executed when perl
+# ends, to release the database handle to libloc.
+END {
+       # Check if a database handle exists.
+       if ($db_handle) {
+               # Destroy libloc database handle.
+               &Location::DESTROY($db_handle);
+       }
+}
+
 1;