From: Stefan Schantl Date: Sat, 7 Nov 2020 18:47:21 +0000 (+0100) Subject: location-functions.pl: Add END block to release the database handle. X-Git-Tag: v2.25-core155~384^2~77 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f46fd078148d4c6959e7ab3c52f1911bd8fea9a6;p=ipfire-2.x.git location-functions.pl: Add END block to release the database handle. Reference #12515. Signed-off-by: Stefan Schantl Signed-off-by: Michael Tremer --- diff --git a/config/cfgroot/location-functions.pl b/config/cfgroot/location-functions.pl index 9b1d0bfb50..4837030161 100644 --- a/config/cfgroot/location-functions.pl +++ b/config/cfgroot/location-functions.pl @@ -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;