]> git.donarmstrong.com Git - samtools.git/blobdiff - sam.c
Allow tabs in the CO header field
[samtools.git] / sam.c
diff --git a/sam.c b/sam.c
index f88ad533dd2aba61a6c16b0d5a10d0972e782c04..ecdee02dddb98a32d47a59e3154179356acecadf 100644 (file)
--- a/sam.c
+++ b/sam.c
@@ -12,7 +12,7 @@ bam_header_t *bam_header_dup(const bam_header_t *h0)
        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);
@@ -55,6 +55,7 @@ samfile_t *samopen(const char *fn, const char *mode, const void *aux)
                                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);
                                }