Changeset: 5540ca0e866b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5540ca0e866b
Modified Files:
        sql/backends/monet5/bam/bam_export.c
        sql/backends/monet5/bam/bam_loader.c
        sql/backends/monet5/bam/bam_wrapper.c
Branch: Oct2014
Log Message:

Coverity-inspired fixes.


diffs (73 lines):

diff --git a/sql/backends/monet5/bam/bam_export.c 
b/sql/backends/monet5/bam/bam_export.c
--- a/sql/backends/monet5/bam/bam_export.c
+++ b/sql/backends/monet5/bam/bam_export.c
@@ -426,7 +426,8 @@ sam_export(Client cntxt, MalBlkPtr mb, M
                goto cleanup;
        }
 
-       write_header(output, fields);
+       if ((msg = write_header(output, fields)) != MAL_SUCCEED)
+               goto cleanup;
 
 
        for (i=0; i<tuple_count; ++i) {
diff --git a/sql/backends/monet5/bam/bam_loader.c 
b/sql/backends/monet5/bam/bam_loader.c
--- a/sql/backends/monet5/bam/bam_loader.c
+++ b/sql/backends/monet5/bam/bam_loader.c
@@ -689,12 +689,13 @@ bam_drop_file(Client cntxt, MalBlkPtr mb
 
        str msg;
 
-       if ((msg =
-                drop_file(cntxt, "bam.drop_file", file_id,
-                          dbschema)) != MAL_SUCCEED) {
-               throw(MAL, "bam_drop_file",
+       msg = drop_file(cntxt, "bam.drop_file", file_id, dbschema);
+       if (msg != MAL_SUCCEED) {
+               str msg2 = createException(MAL, "bam_drop_file",
                          "Error when dropping file with file id '" LLFMT
                          "': %s\n", file_id, msg);
+               GDKfree(msg);
+               return msg2;
        }
 
        (void) stk;
diff --git a/sql/backends/monet5/bam/bam_wrapper.c 
b/sql/backends/monet5/bam/bam_wrapper.c
--- a/sql/backends/monet5/bam/bam_wrapper.c
+++ b/sql/backends/monet5/bam/bam_wrapper.c
@@ -720,6 +720,7 @@ process_header(bam_wrapper * bw)
        str s;
        lng l;
 
+       hl.options = NULL;
        if (bw->type == BAM) {
                header_str = bw->bam.header->text;
        } else {
@@ -2101,7 +2102,8 @@ process_alignments(bam_wrapper * bw, bit
                         * this knowledge to write the alignments for
                         * that qname to suitable files.
                         */
-                       complete_qname_group(aligs, alig_index, bw);
+                       if ((msg = complete_qname_group(aligs, alig_index, bw)) 
!= MAL_SUCCEED)
+                               goto cleanup;
 
                        /* All alignments for the previous qname are
                         * written to files, we can now start
@@ -2173,7 +2175,7 @@ process_alignments(bam_wrapper * bw, bit
                                        if ((aligs =
                                                 GDKrealloc(aligs,
                                                        new_nr_aligs *
-                                                       sizeof(alignment))) ==
+                                                       sizeof(alignment *))) ==
                                                NULL) {
                                                msg = createException(MAL,
                                                                          
"process_alignments",
@@ -2209,7 +2211,7 @@ process_alignments(bam_wrapper * bw, bit
        if (bw->dbschema == 1) {
                /* alignments will still contain at least one
                 * alignment, so empty it */
-               complete_qname_group(aligs, alig_index, bw);
+               msg = complete_qname_group(aligs, alig_index, bw);
        }
 
          cleanup:
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to