int i;
h = bam_header_init();
*h = *h0;
- h->hash = 0;
+ h->hash = h->dict = h->rg2lib = 0;
h->text = (char*)calloc(h->l_text + 1, 1);
memcpy(h->text, h0->text, h->l_text);
h->target_len = (uint32_t*)calloc(h->n_targets, 4);
if (aux) { // check if aux is present
bam_header_t *textheader = fp->header;
fp->header = sam_header_read2((const char*)aux);
+ if (fp->header == 0) goto open_err_ret;
append_header_text(fp->header, textheader->text, textheader->l_text);
bam_header_destroy(textheader);
}