Add missing permission notice in each source file
[babeltrace.git] / formats / ctf / callbacks.c
index 05ddf499a76c915bf2332106d9edbe8d179e7405..71e3248868239fd806d6cceb2bdcce48e9e06886 100644 (file)
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
  */
 
 #include <babeltrace/babeltrace.h>
  */
 
 #include <babeltrace/babeltrace.h>
@@ -73,8 +81,12 @@ int bt_ctf_iter_add_callback(struct bt_ctf_iter *iter,
        int i, stream_id;
        gpointer *event_id_ptr;
        unsigned long event_id;
        int i, stream_id;
        gpointer *event_id_ptr;
        unsigned long event_id;
-       struct trace_collection *tc = iter->parent.ctx->tc;
+       struct trace_collection *tc;
+
+       if (!iter || !callback)
+               return -EINVAL;
 
 
+       tc = iter->parent.ctx->tc;
        for (i = 0; i < tc->array->len; i++) {
                struct ctf_trace *tin;
                struct trace_descriptor *td_read;
        for (i = 0; i < tc->array->len; i++) {
                struct ctf_trace *tin;
                struct trace_descriptor *td_read;
@@ -181,7 +193,11 @@ void process_callbacks(struct bt_ctf_iter *iter,
        enum bt_cb_ret ret;
        struct bt_ctf_event ctf_data;
 
        enum bt_cb_ret ret;
        struct bt_ctf_event ctf_data;
 
+       assert(iter && stream);
+
        ret = extract_ctf_stream_event(stream, &ctf_data);
        ret = extract_ctf_stream_event(stream, &ctf_data);
+       if (ret)
+               goto end;
 
        /* process all events callback first */
        if (iter->main_callbacks.callback) {
 
        /* process all events callback first */
        if (iter->main_callbacks.callback) {
This page took 0.024348 seconds and 4 git commands to generate.