Skip to content

Commit

Permalink
ctr_span: make more checks explicit
Browse files Browse the repository at this point in the history
Signed-off-by: David Korczynski <[email protected]>
  • Loading branch information
DavidKorczynski committed Sep 28, 2023
1 parent 59d8a0b commit a2a2f74
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/ctr_span.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct ctrace_span *ctr_span_create(struct ctrace *ctx, struct ctrace_scope_span

/* allocate a spanc context */
span = calloc(1, sizeof(struct ctrace_span));
if (!span) {
if (span == NULL) {
ctr_errno();
return NULL;
}
Expand All @@ -45,14 +45,14 @@ struct ctrace_span *ctr_span_create(struct ctrace *ctx, struct ctrace_scope_span

/* name */
span->name = cfl_sds_create(name);
if (!span->name) {
if (span->name == NULL) {
free(span);
return NULL;
}

/* attributes */
span->attr = ctr_attributes_create();
if (!span->attr) {
if (span->attr == NULL) {
free(span);
return NULL;
}
Expand Down Expand Up @@ -351,17 +351,17 @@ struct ctrace_span_event *ctr_span_event_add_ts(struct ctrace_span *span, char *
{
struct ctrace_span_event *ev;

if (!name) {
if (name == NULL) {
return NULL;
}

ev = calloc(1, sizeof(struct ctrace_span_event));
if (!ev) {
if (ev == NULL) {
ctr_errno();
return NULL;
}
ev->name = cfl_sds_create(name);
if (!ev->name) {
if (ev->name == NULL) {
free(ev);
return NULL;
}
Expand Down

0 comments on commit a2a2f74

Please sign in to comment.