[monitoring-plugins] check_dns: Fix memory leak

Sven Nierlein git at monitoring-plugins.org
Thu Sep 2 10:00:12 CEST 2021


    Module: monitoring-plugins
    Branch: master
    Commit: 2056c5853175e6ad0e041ff3776e10d9e612b521
    Author: Jonny007-MKD <nospam at jonny007-mkd.de>
 Committer: Sven Nierlein <sven at nierlein.org>
      Date: Sun Feb 23 15:05:42 2020 +0100
       URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=2056c58

check_dns: Fix memory leak

---

 plugins/check_dns.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/check_dns.c b/plugins/check_dns.c
index 0c10f09..2f944f9 100644
--- a/plugins/check_dns.c
+++ b/plugins/check_dns.c
@@ -271,7 +271,7 @@ main (int argc, char **argv)
       result = STATE_CRITICAL;
       xasprintf(&msg, _("Domain '%s' was found by the server: '%s'\n"), query_address, address);
     } else {
-      if (address == NULL) free(address);
+      if (address != NULL) free(address);
       address = "NXDOMAIN";
     }
   }



More information about the Commits mailing list