projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: NULL pointer dereference in relay_index_get_by_id_or_create
[lttng-tools.git]
/
src
/
common
/
utils.c
diff --git
a/src/common/utils.c
b/src/common/utils.c
index 3e0058067fcd2b73bc42fe767c0e022b96b03b39..25639461cc3ae03e147ff0224364c4db21fb8876 100644
(file)
--- a/
src/common/utils.c
+++ b/
src/common/utils.c
@@
-52,7
+52,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 */
@@
-121,6
+121,7
@@
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 */
};
/* Allocate memory for the resolved path if necessary */
@@
-171,6
+172,9
@@
char *utils_partial_realpath(const char *path, char *resolved_path, size_t size)
error:
free(resolved_path);
error:
free(resolved_path);
+ free(cut_path);
+ free(try_path);
+ free(try_path_prev);
return NULL;
}
return NULL;
}
@@
-754,10
+758,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.025148 seconds
and
4
git commands to generate.