mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 02:48:08 +01:00
lib: add talloc reference from string map iterator to map
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.
This commit is contained in:
parent
7b2d7d6512
commit
514a0a6a3b
1 changed files with 3 additions and 0 deletions
|
@ -170,6 +170,9 @@ _notmuch_string_map_iterator_create (notmuch_string_map_t *map, const char *key,
|
||||||
if (unlikely (iter == NULL))
|
if (unlikely (iter == NULL))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if (unlikely (talloc_reference (iter, map) == NULL))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
iter->key = talloc_strdup (iter, key);
|
iter->key = talloc_strdup (iter, key);
|
||||||
iter->exact = exact;
|
iter->exact = exact;
|
||||||
iter->current = bsearch_first (map->pairs, map->length, key, exact);
|
iter->current = bsearch_first (map->pairs, map->length, key, exact);
|
||||||
|
|
Loading…
Reference in a new issue