X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb%2Fopen.c;h=a5a8e875cbcd5ca4ad927ee93474a25b01ab6252;hp=0292920c11b4d565c1f4df9c1b7c032cea995d54;hb=bcf7916c5d694858766869dfd570e525127154a6;hpb=f9757c15a7b61cd4042c060b9fd0e069cb2c31df diff --git a/ccan/tdb/open.c b/ccan/tdb/open.c index 0292920c..a5a8e875 100644 --- a/ccan/tdb/open.c +++ b/ccan/tdb/open.c @@ -55,8 +55,10 @@ static int tdb_new_database(struct tdb_context *tdb, int hash_size) /* We make it up in memory, then write it out if not internal */ size = sizeof(struct tdb_header) + (hash_size+1)*sizeof(tdb_off_t); - if (!(newdb = (struct tdb_header *)calloc(size, 1))) - return TDB_ERRCODE(TDB_ERR_OOM, -1); + if (!(newdb = (struct tdb_header *)calloc(size, 1))) { + tdb->ecode = TDB_ERR_OOM; + return -1; + } /* Fill in the header */ newdb->version = TDB_VERSION;