>From c6f24d39f25cbedfba6f728da48e9666d7240894 Mon Sep 17 00:00:00 2001 From: Bernhard Voelker Date: Thu, 18 Apr 2019 23:04:26 +0200 Subject: [PATCH] ino-map: allow free on NULL * lib/ino-map.c (ino_map_free): Do nothing when MAP is NULL. Since commit 3703dbbe88dd, di_set_free calls ino_map_free which may be NULL. --- ChangeLog | 7 +++++++ lib/ino-map.c | 9 ++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 398c33968..1d96402d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2019-04-18 Bernhard Voelker + + ino-map: allow free on NULL. + * lib/ino-map.c (ino_map_free): Do nothing when MAP is NULL. + Since commit 3703dbbe88dd, di_set_free calls ino_map_free which may + be NULL. + 2019-04-14 Paul Eggert * lib/str-two-way.h: Fix comment typo. diff --git a/lib/ino-map.c b/lib/ino-map.c index c48defa65..9d6bd0894 100644 --- a/lib/ino-map.c +++ b/lib/ino-map.c @@ -105,9 +105,12 @@ ino_map_alloc (size_t next_mapped_ino) void ino_map_free (struct ino_map *map) { - hash_free (map->map); - free (map->probe); - free (map); + if (map) + { + hash_free (map->map); + free (map->probe); + free (map); + } } -- 2.21.0