projects
/
lttng-tools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
c33e672
)
Fix: possible unlink on uninitialized buffer path
author
David Goulet
<dgoulet@efficios.com>
Wed, 12 Mar 2014 17:55:44 +0000
(13:55 -0400)
committer
David Goulet
<dgoulet@efficios.com>
Wed, 12 Mar 2014 17:55:44 +0000
(13:55 -0400)
Fixes coverity issue
1191752
.
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng-sessiond/save.c
patch
|
blob
|
blame
|
history
diff --git
a/src/bin/lttng-sessiond/save.c
b/src/bin/lttng-sessiond/save.c
index d2bf09208e05b3c4a472657d31ea366b4c22ddba..22fab9c05bd013020a83c368fc6a0cadf7ad09e3 100644
(file)
--- a/
src/bin/lttng-sessiond/save.c
+++ b/
src/bin/lttng-sessiond/save.c
@@
-1398,6
+1398,7
@@
int save_session(struct ltt_session *session,
struct lttng_save_session_attr *attr, lttng_sock_cred *creds)
{
int ret, fd;
struct lttng_save_session_attr *attr, lttng_sock_cred *creds)
{
int ret, fd;
+ unsigned int file_opened = 0; /* Indicate if the file has been opened */
char config_file_path[PATH_MAX];
size_t len;
struct config_writer *writer = NULL;
char config_file_path[PATH_MAX];
size_t len;
struct config_writer *writer = NULL;
@@
-1485,6
+1486,7
@@
int save_session(struct ltt_session *session,
ret = LTTNG_ERR_SAVE_IO_FAIL;
goto end;
}
ret = LTTNG_ERR_SAVE_IO_FAIL;
goto end;
}
+ file_opened = 1;
writer = config_writer_create(fd);
if (!writer) {
writer = config_writer_create(fd);
if (!writer) {
@@
-1579,7
+1581,7
@@
end:
}
if (ret) {
/* Delete file in case of error */
}
if (ret) {
/* Delete file in case of error */
- if (unlink(config_file_path)) {
+ if (
file_opened &&
unlink(config_file_path)) {
PERROR("Unlinking XML session configuration.");
}
}
PERROR("Unlinking XML session configuration.");
}
}
This page took
0.03165 seconds
and
4
git commands to generate.