From a9e1f6d927223b4855cd8280d7c986654d3b4d3c Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Fri, 26 May 2017 10:54:14 -0400 Subject: [PATCH] check before dereference. Found by PVS-Studio --- src/modules/rlm_passwd/rlm_passwd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/modules/rlm_passwd/rlm_passwd.c b/src/modules/rlm_passwd/rlm_passwd.c index e8cd8af..b6b9ba0 100644 --- a/src/modules/rlm_passwd/rlm_passwd.c +++ b/src/modules/rlm_passwd/rlm_passwd.c @@ -134,10 +134,11 @@ static void release_hash_table(struct hashtable * ht){ int i; if (!ht) return; - for (i = 0; i < ht->tablesize; i++) - if (ht->table[i]) - destroy_password(ht->table[i]); if (ht->table) { + for (i = 0; i < ht->tablesize; i++) { + if (ht->table[i]) + destroy_password(ht->table[i]); + } free(ht->table); ht->table = NULL; } -- 2.1.4