From: Pavel Rochnyack Date: Sun, 14 Oct 2018 08:45:56 +0000 (+0700) Subject: ntpd: plug potential leak on error X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=7ddd1ef7e969651a0e873277b87d457e2e79a12f;p=collectd.git ntpd: plug potential leak on error Issue: #2942 --- diff --git a/src/ntpd.c b/src/ntpd.c index 9b4ba60c..205403d0 100644 --- a/src/ntpd.c +++ b/src/ntpd.c @@ -873,11 +873,13 @@ static int ntpd_read(void) { ERROR( "ntpd plugin: ntpd_do_query (REQ_PEER_LIST_SUM) failed with status %i", status); + free(ps); return status; } else if ((ps == NULL) || (ps_num == 0) || (ps_size == 0)) { ERROR("ntpd plugin: ntpd_do_query returned unexpected data. " "(ps = %p; ps_num = %i; ps_size = %i)", (void *)ps, ps_num, ps_size); + free(ps); return -1; }