Permalink
Browse files

Fix problems with reinitialization

Change-Id: Ic68ac0866765a355673696dbed06795b653b12dc
Reviewed-on: http://review.couchbase.org/15150
Reviewed-by: Dustin Sallings <dustin@spy.net>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
  • Loading branch information...
1 parent d8e162b commit e069743247e9b46459a3eefd5b6d75e73e8859c7 @trondn trondn committed Apr 24, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/document.c
View
@@ -31,6 +31,9 @@ LIBCBIO_API
cbio_error_t cbio_create_empty_document(libcbio_t handle,
libcbio_document_t *doc)
{
+ if (doc == NULL) {
+ return CBIO_ERROR_EINVAL;
+ }
libcbio_document_t ret = calloc(1, sizeof(*ret));
(void)handle;
*doc = ret;
@@ -62,7 +65,7 @@ void cbio_document_reinitialize(libcbio_document_t doc)
doc->info = NULL;
doc->doc = NULL;
- doc->tmp_alloc_id = doc->tmp_alloc_meta = doc->tmp_alloc_bp;
+ doc->tmp_alloc_id = doc->tmp_alloc_meta = doc->tmp_alloc_bp = NULL;
}
LIBCBIO_API

0 comments on commit e069743

Please sign in to comment.