summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common/container.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/common/container.c b/src/common/container.c
index b5bb6cd0bf..d34299254f 100644
--- a/src/common/container.c
+++ b/src/common/container.c
@@ -760,8 +760,10 @@ strmap_iter_next_rmv(strmap_t *map, strmap_iter_t *iter)
tor_assert(map);
tor_assert(iter);
next = HT_NEXT_RMV(strmap_tree, &map->head, iter);
- tor_free((*iter)->key);
- tor_free(*iter);
+ if (*iter) {
+ tor_free((*iter)->key);
+ tor_free(*iter);
+ }
return next;
}