Skip to content

Commit ee19703

Browse files
committed
Fix warnings
1 parent e830dc1 commit ee19703

File tree

5 files changed

+15
-11
lines changed

5 files changed

+15
-11
lines changed

src/CPE/cpe_session.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ struct oval_agent_session *cpe_session_lookup_oval_session(struct cpe_session *c
114114
return NULL;
115115
}
116116

117-
char *base_name = oscap_basename(prefixed_href);
117+
char *prefixed_href_dup = oscap_strdup(prefixed_href);
118+
char *base_name = oscap_basename(prefixed_href_dup);
119+
free(prefixed_href_dup);
118120
session = oval_agent_new_session(oval_model, base_name);
119121
free(base_name);
120122
if (session == NULL) {

src/OVAL/probes/independent/yamlfilecontent_probe.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,13 +392,15 @@ static int process_yaml_file(const char *prefix, const char *path, const char *f
392392
{
393393
int ret = 0;
394394

395-
yaml_parser_t parser;
396-
yaml_parser_initialize(&parser);
397-
398395
char *filepath = oscap_path_join(path, filename);
399396
if (probe_path_is_blocked(filepath, ctx->blocked_paths)) {
400-
goto cleanup;
397+
free(filepath);
398+
return 0;
401399
}
400+
401+
yaml_parser_t parser;
402+
yaml_parser_initialize(&parser);
403+
402404
char *filepath_with_prefix = oscap_path_join(prefix, filepath);
403405

404406
FILE *yaml_file = fopen(filepath_with_prefix, "r");

src/OVAL/probes/unix/xinetd_probe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ xiconf_t *xiconf_parse(const char *path, unsigned int max_depth)
746746

747747
switch (inctype) {
748748
case XICONF_INCTYPE_FILE:
749-
strncpy (pathbuf, inclarg, sizeof(pathbuf));
749+
strncpy (pathbuf, inclarg, sizeof(pathbuf)-1);
750750

751751
dD("includefile: %s", pathbuf);
752752

src/OVAL/results/oval_cmp_evr_string.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ static inline int rpmevrcmp(const char *a, const char *b)
9191
/* This mimics rpmevrcmp which is not exported by rpmlib version 4.
9292
* Code inspired by rpm.labelCompare() from rpm4/python/header-py.c
9393
*/
94-
const char *a_epoch, *a_version, *a_release;
95-
const char *b_epoch, *b_version, *b_release;
94+
const char *a_epoch = NULL, *a_version = NULL, *a_release = NULL;
95+
const char *b_epoch = NULL, *b_version = NULL, *b_release = NULL;
9696
char *a_copy, *b_copy;
9797
int result;
9898

@@ -399,8 +399,8 @@ static int dpkg_version_compare(struct dpkg_version *a, struct dpkg_version *b)
399399
oval_result_t oval_debian_evr_string_cmp(const char *state, const char *sys, oval_operation_t operation)
400400
{
401401
struct dpkg_version a, b;
402-
const char *a_epoch, *a_version, *a_release;
403-
const char *b_epoch, *b_version, *b_release;
402+
const char *a_epoch = NULL, *a_version = NULL, *a_release = NULL;
403+
const char *b_epoch = NULL, *b_version = NULL, *b_release = NULL;
404404
char *a_copy, *b_copy;
405405
long aux;
406406

swig/python3/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ include_directories(${PYTHON_INCLUDE_PATH})
55

66
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
77

8-
set(CMAKE_SWIG_FLAGS "-module" "openscap_py" "-py3")
8+
set(CMAKE_SWIG_FLAGS "-module" "openscap_py")
99
if (${CMAKE_VERSION} VERSION_LESS "3.8.0")
1010
swig_add_module(openscap_py python ../openscap.i)
1111
else()

0 commit comments

Comments
 (0)