Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
fp = fdopen(fd, "r");
if (fp == NULL) {
perror("kernel tracepoint list fdopen");
- goto error;
+ goto error_fp;
}
/*
elist = realloc(elist, nbmem);
if (elist == NULL) {
perror("realloc list events");
- goto error;
+ count = -ENOMEM;
+ goto end;
}
}
strncpy(elist[count].name, event, LTTNG_SYMBOL_NAME_LEN);
}
*events = elist;
-
DBG("Kernel list events done (%zu events)", count);
-
+end:
+ fclose(fp); /* closes both fp and fd */
return count;
+error_fp:
+ close(fd);
error:
return -1;
}