r316: don't allocate zero-length memory

It is not a bug, but Electric Fence does not like that.
This commit is contained in:
Heng Li 2013-03-04 10:22:18 -05:00
parent 35fb7f9fdf
commit d35f33b513
2 changed files with 2 additions and 2 deletions

View File

@ -124,7 +124,7 @@ bntseq_t *bns_restore_core(const char *ann_filename, const char* amb_filename, c
fscanf(fp, "%lld%d%d", &xx, &n_seqs, &bns->n_holes);
l_pac = xx;
xassert(l_pac == bns->l_pac && n_seqs == bns->n_seqs, "inconsistent .ann and .amb files.");
bns->ambs = (bntamb1_t*)calloc(bns->n_holes, sizeof(bntamb1_t));
bns->ambs = bns->n_holes? (bntamb1_t*)calloc(bns->n_holes, sizeof(bntamb1_t)) : 0;
for (i = 0; i < bns->n_holes; ++i) {
bntamb1_t *p = bns->ambs + i;
fscanf(fp, "%lld%d%s", &xx, &p->len, str);

2
main.c
View File

@ -4,7 +4,7 @@
#include "utils.h"
#ifndef PACKAGE_VERSION
#define PACKAGE_VERSION "0.7.0-r315"
#define PACKAGE_VERSION "0.7.0-r316"
#endif
static int usage()