summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Allbery <eagle@eyrie.org>2022-05-08 13:39:32 -0700
committerRuss Allbery <eagle@eyrie.org>2022-05-08 16:42:47 -0700
commit139bccbdad462695bf192be764bf2c931baa54a6 (patch)
tree56f92ffa06fb1a3f6c1014eb676bf9c8e6ec794f
parent903ad187b0cbeadb65de93378b46f08efb1a52df (diff)
Work around cppcheck diagnostic of kerberos_free
cppcheck thinks its argument can be const, which while technically true would be weird since it invalidates its argument. Free the passed argument instead of the static variable to avoid this diagnostic.
-rw-r--r--tests/tap/kerberos.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/tap/kerberos.c b/tests/tap/kerberos.c
index b91ce70..ae571dc 100644
--- a/tests/tap/kerberos.c
+++ b/tests/tap/kerberos.c
@@ -227,7 +227,14 @@ kerberos_free(struct kerberos_config *config_arg)
free(config->password);
free(config->pkinit_principal);
free(config->pkinit_cert);
- free(config);
+
+ /*
+ * Free config_arg rather than config, since otherwise cppcheck thinks
+ * that config_arg could be const, which while technically true would
+ * look very weird since config_arg is invalidated by calling this
+ * function.
+ */
+ free(config_arg);
config = NULL;
}
if (krb5ccname != NULL) {