X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=formats%2Fctf%2Fcallbacks.c;h=71e3248868239fd806d6cceb2bdcce48e9e06886;hp=05ddf499a76c915bf2332106d9edbe8d179e7405;hb=c462e188f3e7819c7bc74f671038cdbf36e8c3c0;hpb=c50d2a7af8f63f3f4d2c0a6fce9a6e214d2baeda diff --git a/formats/ctf/callbacks.c b/formats/ctf/callbacks.c index 05ddf499..71e32488 100644 --- a/formats/ctf/callbacks.c +++ b/formats/ctf/callbacks.c @@ -16,6 +16,14 @@ * * 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 @@ -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; - 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; @@ -181,7 +193,11 @@ void process_callbacks(struct bt_ctf_iter *iter, enum bt_cb_ret ret; struct bt_ctf_event ctf_data; + assert(iter && stream); + ret = extract_ctf_stream_event(stream, &ctf_data); + if (ret) + goto end; /* process all events callback first */ if (iter->main_callbacks.callback) {