Implement a single return point in delete_trace() which ensures
that trace_dir is not leaked on error.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
trace_dir = opendir(trace_path);
if (!trace_dir) {
PERROR("Cannot open '%s' path", trace_path);
trace_dir = opendir(trace_path);
if (!trace_dir) {
PERROR("Cannot open '%s' path", trace_path);
+ ret = -errno;
+ goto end;
}
trace_dir_fd = dirfd(trace_dir);
if (trace_dir_fd < 0) {
PERROR("dirfd");
}
trace_dir_fd = dirfd(trace_dir);
if (trace_dir_fd < 0) {
PERROR("dirfd");
+ ret = -errno;
+ goto end;
}
while ((entry = readdir(trace_dir))) {
}
while ((entry = readdir(trace_dir))) {