notmuch_filenames_create: Take a reference to underlying filename list
authorCarl Worth <cworth@cworth.org>
Thu, 11 Nov 2010 11:36:13 +0000 (03:36 -0800)
committerCarl Worth <cworth@cworth.org>
Thu, 11 Nov 2010 11:40:19 +0000 (03:40 -0800)
The notmuch_filenames_t object might easily outlive the original object
owning the filename list. So take a talloc reference to keep things safe.

lib/filenames.c

index 50e1435488d04ae5c5bd59faa9f451a4dfba5d8f..f078c95579c9fabbb1c54f101de809386130f85a 100644 (file)
@@ -79,6 +79,7 @@ _notmuch_filenames_create (const void *ctx,
        return NULL;
 
     filenames->iterator = list->head;
        return NULL;
 
     filenames->iterator = list->head;
+    (void) talloc_reference (filenames, list);
 
     return filenames;
 }
 
     return filenames;
 }