projects
/
lttng-ust.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: channel leak on error
[lttng-ust.git]
/
liblttng-ust
/
lttng-ust-abi.c
diff --git
a/liblttng-ust/lttng-ust-abi.c
b/liblttng-ust/lttng-ust-abi.c
index 24769a7d6571f5fe49ea90ab4f1dcc7443b822ba..daf0d5e4caa0185652605e9a0496c2ad0fb2f0b3 100644
(file)
--- a/
liblttng-ust/lttng-ust-abi.c
+++ b/
liblttng-ust/lttng-ust-abi.c
@@
-393,6
+393,7
@@
static const struct lttng_ust_objd_ops lttng_ops = {
.cmd = lttng_cmd,
};
.cmd = lttng_cmd,
};
+static
int lttng_abi_map_channel(int session_objd,
struct lttng_ust_channel *ust_chan,
union ust_args *uargs,
int lttng_abi_map_channel(int session_objd,
struct lttng_ust_channel *ust_chan,
union ust_args *uargs,
@@
-437,6
+438,10
@@
int lttng_abi_map_channel(int session_objd,
goto handle_error;
}
goto handle_error;
}
+ /* Ownership of chan_data and wakeup_fd taken by channel handle. */
+ uargs->channel.chan_data = NULL;
+ uargs->channel.wakeup_fd = -1;
+
chan = shmp(channel_handle, channel_handle->chan);
assert(chan);
chan->handle = channel_handle;
chan = shmp(channel_handle, channel_handle->chan);
assert(chan);
chan->handle = channel_handle;
@@
-520,24
+525,9
@@
alloc_error:
channel_destroy(chan, channel_handle, 0);
return ret;
channel_destroy(chan, channel_handle, 0);
return ret;
- /*
- * error path before channel creation (owning chan_data and
- * wakeup_fd).
- */
handle_error:
active:
invalid:
handle_error:
active:
invalid:
- {
- int close_ret;
-
- lttng_ust_lock_fd_tracker();
- close_ret = close(wakeup_fd);
- lttng_ust_unlock_fd_tracker();
- if (close_ret) {
- PERROR("close");
- }
- }
- free(chan_data);
return ret;
}
return ret;
}
This page took
0.023538 seconds
and
4
git commands to generate.