Permalink
Browse files

Fixed a crash in error handling (free_modres called on NULL)

Better to make this accept NULL the way most free_XXX functions do.

Change-Id: Idd60072a589797bd82d1b20ecc04cfca6b0a9dde
Reviewed-on: http://review.couchbase.org/14862
Tested-by: Damien Katz <damien@couchbase.com>
Reviewed-by: Damien Katz <damien@couchbase.com>
  • Loading branch information...
1 parent 1c06100 commit e7d9023ef3cc7cf316d3abdcae7214f1db008665 @snej snej committed with Damien Katz Apr 13, 2012
Showing with 5 additions and 3 deletions.
  1. +5 −3 src/btree_modify.c
View
@@ -72,9 +72,11 @@ static couchfile_modify_result *make_modres(couchfile_modify_request *rq)
static void free_modres(couchfile_modify_result *mr)
{
- free_nodelist(mr->values);
- free_nodelist(mr->pointers);
- free(mr);
+ if (mr) {
+ free_nodelist(mr->values);
+ free_nodelist(mr->pointers);
+ free(mr);
+ }
}
static couchstore_error_t mr_push_item(sized_buf *k, sized_buf *v, couchfile_modify_result *dst)

0 comments on commit e7d9023

Please sign in to comment.