Fix: NULL dereference in logging on btr allocation failure
[babeltrace.git] / plugins / ctf / common / btr / btr.c
index e7762a3dd08af0ae08510f17ad41ebf62728c611..c802d83de667de9009eaabbfccb55abae5370ff1 100644 (file)
  * SOFTWARE.
  */
 
+#include <stdlib.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stddef.h>
 #include <stdbool.h>
 #include <assert.h>
 #include <string.h>
-#include <babeltrace/bitfield.h>
+#include <babeltrace/bitfield-internal.h>
 #include <babeltrace/ctf-ir/field-types.h>
 #include <babeltrace/ref.h>
-#include <babeltrace/align.h>
+#include <babeltrace/align-internal.h>
 #include <glib.h>
 
 #include "btr.h"
 
-#define PRINT_ERR_STREAM       btr->err_stream
+#define PRINT_ERR_STREAM       (btr ? btr->err_stream : stderr)
 #define PRINT_PREFIX           "ctf-btr"
-#include "print.h"
+#include "../print.h"
 
 #define DIV8(_x)                       ((_x) >> 3)
 #define BYTES_TO_BITS(_x)              ((_x) * 8)
@@ -999,7 +1000,7 @@ enum bt_ctf_btr_status read_basic_begin_state(struct bt_ctf_btr *btr)
                status = read_basic_string_type_and_call(btr, true);
                break;
        default:
-               assert(false);
+               abort();
        }
 
        return status;
@@ -1026,7 +1027,7 @@ enum bt_ctf_btr_status read_basic_continue_state(struct bt_ctf_btr *btr)
                status = read_basic_string_type_and_call(btr, false);
                break;
        default:
-               assert(false);
+               abort();
        }
 
        return status;
This page took 0.046503 seconds and 4 git commands to generate.