diff options
author | Austin Clements <amdragon@MIT.EDU> | 2012-01-29 00:50:08 -0500 |
---|---|---|
committer | David Bremner <bremner@debian.org> | 2012-02-03 21:14:59 -0400 |
commit | a8ee1c75c348f41d88398fc394812e66e8e8b72e (patch) | |
tree | 55d1792cbd649358286d12c3a6172932f1405bd2 | |
parent | 6dec2af55bb393e338586a2a399a659e54240a1f (diff) |
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.
-rw-r--r-- | lib/database.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/database.cc b/lib/database.cc index 8103bd96..a6d15a13 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -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); |