mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-25 12:28:09 +01:00
lib: Don't delete uninitialized pointers
In the error-handling paths of notmuch_database_open, we call notmuch_database_close, which "delete"s several objects referenced by the notmuch_database_t object. However, some of these pointers may be uninitialized, resulting in undefined behavior. Hence, allocate the notmuch_database_t with talloc_zero to make sure these pointers are NULL so that "delete"ing them is harmless.
This commit is contained in:
parent
6dec2af55b
commit
a8ee1c75c3
1 changed files with 1 additions and 1 deletions
|
@ -617,7 +617,7 @@ notmuch_database_open (const char *path,
|
|||
initialized = 1;
|
||||
}
|
||||
|
||||
notmuch = talloc (NULL, notmuch_database_t);
|
||||
notmuch = talloc_zero (NULL, notmuch_database_t);
|
||||
notmuch->exception_reported = FALSE;
|
||||
notmuch->path = talloc_strdup (notmuch, path);
|
||||
|
||||
|
|
Loading…
Reference in a new issue