diff --git a/daemon/augeas.c b/daemon/augeas.c index 03cba42118..83d24ad3fc 100644 --- a/daemon/augeas.c +++ b/daemon/augeas.c @@ -38,6 +38,17 @@ */ static augeas *aug = NULL; +/* Clean up the augeas handle on daemon exit. */ +static void aug_finalize (void) __attribute__((destructor)); +static void +aug_finalize (void) +{ + if (aug) { + aug_close (aug); + aug = NULL; + } +} + #define NEED_AUG(errcode) \ do { \ if (!aug) { \