|
|
796159 |
From 204c580643f7c52364520926b9df3a621fab6df7 Mon Sep 17 00:00:00 2001
|
|
|
796159 |
From: Martin Sehnoutka <msehnout@redhat.com>
|
|
|
796159 |
Date: Tue, 24 Jul 2018 15:10:40 +0200
|
|
|
796159 |
Subject: [PATCH] fix covscan issues
|
|
|
796159 |
|
|
|
796159 |
---
|
|
|
796159 |
lib/libexpat_metalink_parser.c | 3 +++
|
|
|
796159 |
lib/metalink_pctrl.c | 2 ++
|
|
|
796159 |
2 files changed, 5 insertions(+)
|
|
|
796159 |
|
|
|
796159 |
diff --git a/lib/libexpat_metalink_parser.c b/lib/libexpat_metalink_parser.c
|
|
|
796159 |
index 4e73aef..79b091c 100644
|
|
|
796159 |
--- a/lib/libexpat_metalink_parser.c
|
|
|
796159 |
+++ b/lib/libexpat_metalink_parser.c
|
|
|
796159 |
@@ -29,6 +29,7 @@
|
|
|
796159 |
|
|
|
796159 |
#include <string.h>
|
|
|
796159 |
#include <unistd.h>
|
|
|
796159 |
+#include <stdlib.h>
|
|
|
796159 |
#include <errno.h>
|
|
|
796159 |
#include <assert.h>
|
|
|
796159 |
|
|
|
796159 |
@@ -56,6 +57,8 @@ static void split_ns_name(const char** localname,
|
|
|
796159 |
*localname = sep+1;
|
|
|
796159 |
len = sep-src;
|
|
|
796159 |
temp = malloc((len+1) * sizeof **ns_uri);
|
|
|
796159 |
+ if (temp == NULL)
|
|
|
796159 |
+ exit(EXIT_FAILURE);
|
|
|
796159 |
memcpy(temp, src, len);
|
|
|
796159 |
temp[len] = '\0';
|
|
|
796159 |
*ns_uri = temp;
|
|
|
796159 |
diff --git a/lib/metalink_pctrl.c b/lib/metalink_pctrl.c
|
|
|
796159 |
index c25989b..e6fb8f8 100644
|
|
|
796159 |
--- a/lib/metalink_pctrl.c
|
|
|
796159 |
+++ b/lib/metalink_pctrl.c
|
|
|
796159 |
@@ -469,6 +469,7 @@ metalink_error_t metalink_pctrl_file_set_language(metalink_pctrl_t* ctrl, const
|
|
|
796159 |
l = strdup(language);
|
|
|
796159 |
ctrl->languages = metalink_list_new();
|
|
|
796159 |
if(!ctrl->languages || !l || metalink_list_append(ctrl->languages, l) != 0) {
|
|
|
796159 |
+ if (l) free(l);
|
|
|
796159 |
return METALINK_ERR_BAD_ALLOC;
|
|
|
796159 |
}
|
|
|
796159 |
|
|
|
796159 |
@@ -486,6 +487,7 @@ metalink_error_t metalink_pctrl_file_set_os(metalink_pctrl_t* ctrl, const char*
|
|
|
796159 |
o = strdup(os);
|
|
|
796159 |
ctrl->oses = metalink_list_new();
|
|
|
796159 |
if(!ctrl->oses || !o || metalink_list_append(ctrl->oses, o) != 0) {
|
|
|
796159 |
+ if (o) free(o);
|
|
|
796159 |
return METALINK_ERR_BAD_ALLOC;
|
|
|
796159 |
}
|
|
|
796159 |
|
|
|
796159 |
--
|
|
|
796159 |
2.17.1
|
|
|
796159 |
|