projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: libc internal mutex races with run_as
[lttng-tools.git]
/
src
/
common
/
utils.c
diff --git
a/src/common/utils.c
b/src/common/utils.c
index 337713eb78ab39493bb745c994d7d43df9400d0f..3c9e70ddad6439ee362d9187c751151eca60d32a 100644
(file)
--- a/
src/common/utils.c
+++ b/
src/common/utils.c
@@
-55,7
+55,7
@@
LTTNG_HIDDEN
char *utils_partial_realpath(const char *path, char *resolved_path, size_t size)
{
LTTNG_HIDDEN
char *utils_partial_realpath(const char *path, char *resolved_path, size_t size)
{
- char *cut_path, *try_path = NULL, *try_path_prev = NULL;
+ char *cut_path
= NULL
, *try_path = NULL, *try_path_prev = NULL;
const char *next, *prev, *end;
/* Safety net */
const char *next, *prev, *end;
/* Safety net */
@@
-124,7
+124,8
@@
char *utils_partial_realpath(const char *path, char *resolved_path, size_t size)
/* Free the allocated memory */
free(cut_path);
/* Free the allocated memory */
free(cut_path);
- };
+ cut_path = NULL;
+ }
/* Allocate memory for the resolved path if necessary */
if (resolved_path == NULL) {
/* Allocate memory for the resolved path if necessary */
if (resolved_path == NULL) {
@@
-161,6
+162,8
@@
char *utils_partial_realpath(const char *path, char *resolved_path, size_t size)
/* Free the allocated memory */
free(cut_path);
free(try_path_prev);
/* Free the allocated memory */
free(cut_path);
free(try_path_prev);
+ cut_path = NULL;
+ try_path_prev = NULL;
/*
* Else, we just copy the path in our resolved_path to
* return it as is
/*
* Else, we just copy the path in our resolved_path to
* return it as is
@@
-174,6
+177,7
@@
char *utils_partial_realpath(const char *path, char *resolved_path, size_t size)
error:
free(resolved_path);
error:
free(resolved_path);
+ free(cut_path);
return NULL;
}
return NULL;
}
@@
-763,10
+767,6
@@
int utils_unlink_stream_file(const char *path_name, char *file_name, uint64_t si
ret = unlink(path);
} else {
ret = run_as_unlink(path, uid, gid);
ret = unlink(path);
} else {
ret = run_as_unlink(path, uid, gid);
- if (ret < 0) {
- errno = -ret;
- ret = -1;
- }
}
if (ret < 0) {
goto error;
}
if (ret < 0) {
goto error;
This page took
0.025959 seconds
and
5
git commands to generate.