projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: Free variable before strdup() in process_event_node
[lttng-tools.git]
/
src
/
common
/
config
/
config.c
diff --git
a/src/common/config/config.c
b/src/common/config/config.c
index 48dc0b0341eac709442da6fab1bdcc6136bc05b5..0253d58d3d9bedb55c7299ae0aa4eb57a8b7e6e2 100644
(file)
--- a/
src/common/config/config.c
+++ b/
src/common/config/config.c
@@
-27,6
+27,7
@@
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <stdbool.h>
#include <common/defaults.h>
#include <common/error.h>
#include <common/defaults.h>
#include <common/error.h>
@@
-1559,6
+1560,7
@@
int process_event_node(xmlNodePtr event_node, struct lttng_handle *handle,
goto end;
}
goto end;
}
+ free(filter_expression);
filter_expression = strdup((char *) content);
free(content);
if (!filter_expression) {
filter_expression = strdup((char *) content);
free(content);
if (!filter_expression) {
@@
-2743,8
+2745,8
@@
end:
}
}
}
}
- if (
!
session_found) {
- ret =
-LTTNG_ERR_LOAD_SESSION_NOENT
;
+ if (session_found) {
+ ret =
0
;
}
return ret;
}
return ret;
@@
-2789,6
+2791,7
@@
int config_load_session(const char *path, const char *session_name,
int override, unsigned int autoload)
{
int ret;
int override, unsigned int autoload)
{
int ret;
+ bool session_loaded = false;
const char *path_ptr = NULL;
struct session_config_validation_ctx validation_ctx = { 0 };
const char *path_ptr = NULL;
struct session_config_validation_ctx validation_ctx = { 0 };
@@
-2847,6
+2850,7
@@
int config_load_session(const char *path, const char *session_name,
* Continue even if the session was found since we have to try
* the system wide sessions.
*/
* Continue even if the session was found since we have to try
* the system wide sessions.
*/
+ session_loaded = true;
}
}
}
}
@@
-2869,6
+2873,9
@@
int config_load_session(const char *path, const char *session_name,
if (path_ptr) {
ret = load_session_from_path(path_ptr, session_name,
&validation_ctx, override);
if (path_ptr) {
ret = load_session_from_path(path_ptr, session_name,
&validation_ctx, override);
+ if (!ret) {
+ session_loaded = true;
+ }
}
} else {
ret = access(path, F_OK);
}
} else {
ret = access(path, F_OK);
@@
-2901,5
+2908,10
@@
end:
*/
ret = 0;
}
*/
ret = 0;
}
+
+ if (session_loaded && ret == -LTTNG_ERR_LOAD_SESSION_NOENT) {
+ /* A matching session was found in one of the search paths. */
+ ret = 0;
+ }
return ret;
}
return ret;
}
This page took
0.027371 seconds
and
4
git commands to generate.