From: Johnny Jacob Date: Sat, 11 Aug 2007 21:29:11 +0000 (+0000) Subject: Fix for 387806 by Rob Bradford X-Git-Tag: upstream/3.7.4~5604 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7552bcbe3ee6fad8768b2bd10a6350e7e878ac38;p=platform%2Fupstream%2Fevolution-data-server.git Fix for 387806 by Rob Bradford svn path=/trunk/; revision=7938 --- diff --git a/camel/ChangeLog b/camel/ChangeLog index e804210..268a674 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,4 +1,11 @@ 2007-08-12 Johnny Jacob + + ** Fix for 387806 by Rob Bradford + + * camel-text-index.c: Add some checking of return values when + calling camel_block_file_new_block. + +2007-08-12 Johnny Jacob ** Fix for Bug 261084 from Jared Moore diff --git a/camel/camel-text-index.c b/camel/camel-text-index.c index 0a9952b..2effad6 100644 --- a/camel/camel-text-index.c +++ b/camel/camel-text-index.c @@ -844,14 +844,16 @@ camel_text_index_new(const char *path, int flags) p->links = camel_key_file_new(link, flags, CAMEL_TEXT_INDEX_KEY_VERSION); if (p->blocks == NULL || p->links == NULL) { - camel_object_unref((CamelObject *)idx); - return NULL; - } + goto fail; rb = (struct _CamelTextIndexRoot *)p->blocks->root; if (rb->word_index_root == 0) { bl = camel_block_file_new_block(p->blocks); + + if (bl == NULL) + goto fail; + rb->word_index_root = bl->id; camel_block_file_unref_block(p->blocks, bl); camel_block_file_touch_block(p->blocks, p->blocks->root_block); @@ -859,6 +861,10 @@ camel_text_index_new(const char *path, int flags) if (rb->word_hash_root == 0) { bl = camel_block_file_new_block(p->blocks); + + if (bl == NULL) + goto fail; + rb->word_hash_root = bl->id; camel_block_file_unref_block(p->blocks, bl); camel_block_file_touch_block(p->blocks, p->blocks->root_block); @@ -866,6 +872,10 @@ camel_text_index_new(const char *path, int flags) if (rb->name_index_root == 0) { bl = camel_block_file_new_block(p->blocks); + + if (bl == NULL) + goto fail; + rb->name_index_root = bl->id; camel_block_file_unref_block(p->blocks, bl); camel_block_file_touch_block(p->blocks, p->blocks->root_block); @@ -873,6 +883,10 @@ camel_text_index_new(const char *path, int flags) if (rb->name_hash_root == 0) { bl = camel_block_file_new_block(p->blocks); + + if (bl == NULL) + goto fail; + rb->name_hash_root = bl->id; camel_block_file_unref_block(p->blocks, bl); camel_block_file_touch_block(p->blocks, p->blocks->root_block); @@ -890,6 +904,10 @@ camel_text_index_new(const char *path, int flags) } return idx; + +fail: + camel_object_unref((CamelObject *)idx); + return NULL; } /* returns 0 if the index exists, is valid, and synced, -1 otherwise */