projects
/
notmuch.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7b2d7d6
)
lib: add talloc reference from string map iterator to map
author
David Bremner
<david@tethera.net>
Fri, 23 Sep 2016 09:33:19 +0000
(06:33 -0300)
committer
David Bremner
<david@tethera.net>
Sat, 24 Sep 2016 13:08:45 +0000
(10:08 -0300)
This is needed so that when the map is modified during traversal, and
thus unlinked by the database code, the map is not disposed of until the
iterator is done with it.
lib/string-map.c
patch
|
blob
|
history
diff --git
a/lib/string-map.c
b/lib/string-map.c
index 591ff6d5bdc525d5b507d30c12f8d41921c29502..0bb77e93aaec8e461a4bc27778d17598e116f255 100644
(file)
--- a/
lib/string-map.c
+++ b/
lib/string-map.c
@@
-170,6
+170,9
@@
_notmuch_string_map_iterator_create (notmuch_string_map_t *map, const char *key,
if (unlikely (iter == NULL))
return NULL;
+ if (unlikely (talloc_reference (iter, map) == NULL))
+ return NULL;
+
iter->key = talloc_strdup (iter, key);
iter->exact = exact;
iter->current = bsearch_first (map->pairs, map->length, key, exact);