aboutsummaryrefslogtreecommitdiffstats
path: root/tests/asschk.c
diff options
context:
space:
mode:
authorJim Meyering <[email protected]>2011-09-20 14:35:30 +0000
committerWerner Koch <[email protected]>2011-09-20 16:14:51 +0000
commit850f09b2e30c58e338ca621e459c148650a4caa2 (patch)
tree1b26cd2b4be9ee0070beec2d5897eb05218e4241 /tests/asschk.c
parentavoid use of freed pointer (diff)
downloadgnupg-850f09b2e30c58e338ca621e459c148650a4caa2.tar.gz
gnupg-850f09b2e30c58e338ca621e459c148650a4caa2.zip
tests: avoid use of freed pointer
[spotted by coverity] This is only in tests/, but easy to fix, so... I've included extra context so you can see how var->value would be used in the following atoi call. >From cf9ae83fd2da8d7a289b048ef0feed4096f6d263 Mon Sep 17 00:00:00 2001 From: Jim Meyering <[email protected]> Date: Tue, 20 Sep 2011 16:32:59 +0200 Subject: [PATCH] avoid use of free'd pointer * asschk.c (set_type_var): Set var->value to NULL after freeing it, to avoid subsequent use of freed pointer.
Diffstat (limited to 'tests/asschk.c')
-rw-r--r--tests/asschk.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/asschk.c b/tests/asschk.c
index 3eb262178..c0108e71d 100644
--- a/tests/asschk.c
+++ b/tests/asschk.c
@@ -514,7 +514,10 @@ set_type_var (const char *name, const char *value, VARTYPE type)
variable_list = var;
}
else
- free (var->value);
+ {
+ free (var->value);
+ var->value = NULL;
+ }
if (var->type == VARTYPE_FD && var->value)
{