pos->dummy = false;
pos->cur_index = 0;
pos->packet_real_index = NULL;
- if (fd >= 0)
+ if (fd >= 0) {
pos->packet_cycles_index = g_array_new(FALSE, TRUE,
sizeof(struct packet_index));
- else
+ pos->packet_real_index = g_array_new(FALSE, TRUE,
+ sizeof(struct packet_index));
+ } else {
pos->packet_cycles_index = NULL;
+ pos->packet_real_index = NULL;
+ }
switch (open_flags & O_ACCMODE) {
case O_RDONLY:
pos->prot = PROT_READ;
assert(0);
}
}
- (void) g_array_free(pos->packet_cycles_index, TRUE);
- (void) g_array_free(pos->packet_real_index, TRUE);
+ if (pos->packet_cycles_index)
+ (void) g_array_free(pos->packet_cycles_index, TRUE);
+ if (pos->packet_real_index)
+ (void) g_array_free(pos->packet_real_index, TRUE);
}
/*
cfs = container_of(stream, struct ctf_file_stream,
parent);
stream_pos = &cfs->pos;
- stream_pos->packet_real_index = g_array_new(FALSE, TRUE,
- sizeof(struct packet_index));
-
if (!stream_pos->packet_cycles_index)
continue;