Cleanup: shut up gcc uninitialized var warning
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 24 Aug 2012 01:00:23 +0000 (21:00 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 24 Aug 2012 01:00:23 +0000 (21:00 -0400)
Even though it should never be used unset (due to return value), let's
be extra careful and check if indeed not set, and return an error in
that case.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lib/iterator.c

index 927444f47931885ea166be040b5133a8261827fe..a06d66bdd34790feaea7a2ca477b59b0b89fd93a 100644 (file)
@@ -480,11 +480,11 @@ int bt_iter_set_pos(struct bt_iter *iter, const struct bt_iter_pos *iter_pos)
                break;
        case BT_SEEK_LAST:
        {
-               struct ctf_file_stream *cfs;
+               struct ctf_file_stream *cfs = NULL;
 
                tc = iter->ctx->tc;
                ret = seek_last_ctf_trace_collection(tc, &cfs);
-               if (ret != 0)
+               if (ret != 0 || !cfs)
                        goto error;
                /* remove all streams from the heap */
                heap_free(iter->stream_heap);
This page took 0.036471 seconds and 4 git commands to generate.