improve coverity fix
This commit is contained in:
parent
b635ba9b78
commit
551a854f15
@ -1,55 +1,3 @@
|
||||
diff -up librtas-2.0.2/librtasevent_src/rtas_srcfru.c.me librtas-2.0.2/librtasevent_src/rtas_srcfru.c
|
||||
--- librtas-2.0.2/librtasevent_src/rtas_srcfru.c.me 2021-03-25 09:43:12.764393426 +0100
|
||||
+++ librtas-2.0.2/librtasevent_src/rtas_srcfru.c 2021-03-25 10:00:06.013239296 +0100
|
||||
@@ -238,9 +238,10 @@ parse_src_scn(struct rtas_event *re)
|
||||
|
||||
add_re_scn(re, src, re_scn_id(&src_raw->v6hdr));
|
||||
|
||||
- if (!src_subscns_included(src))
|
||||
+ if (!src_subscns_included(src)) {
|
||||
+ free (src_raw);
|
||||
return 0;
|
||||
-
|
||||
+ }
|
||||
rtas_copy( (char *) src_raw + RE_SRC_SCN_SZ + 4, re, RE_SRC_SUBSCN_SZ);
|
||||
|
||||
src->subscn_id = src_raw->subscn_id;
|
||||
@@ -260,6 +261,7 @@ parse_src_scn(struct rtas_event *re)
|
||||
if (fru == NULL) {
|
||||
cleanup_rtas_event(re);
|
||||
errno = ENOMEM;
|
||||
+ free(src_raw);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -288,6 +290,8 @@ parse_src_scn(struct rtas_event *re)
|
||||
|
||||
if (cur_fruhdr == NULL) {
|
||||
cleanup_rtas_event(re);
|
||||
+ free(src_raw);
|
||||
+ free(fru);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -309,6 +313,7 @@ parse_src_scn(struct rtas_event *re)
|
||||
total_len += fru->length;
|
||||
} while (total_len < srcsub_len);
|
||||
|
||||
+ free(src_raw);
|
||||
return 0;
|
||||
}
|
||||
|
||||
diff -up librtas-2.0.2/librtasevent_src/rtas_vend.c.me librtas-2.0.2/librtasevent_src/rtas_vend.c
|
||||
--- librtas-2.0.2/librtasevent_src/rtas_vend.c.me 2021-03-25 10:00:29.520558410 +0100
|
||||
+++ librtas-2.0.2/librtasevent_src/rtas_vend.c 2021-03-25 10:03:25.367951457 +0100
|
||||
@@ -116,6 +116,7 @@ parse_vend_errlog_scn(struct rtas_event
|
||||
ve->vendor_data = malloc(ve->vendor_data_sz);
|
||||
if (ve->vendor_data == NULL) {
|
||||
errno = ENOMEM;
|
||||
+ free(ve);
|
||||
return -1;
|
||||
}
|
||||
|
||||
diff -up librtas-2.0.2/librtasevent_src/get_rtas_event.c.me librtas-2.0.2/librtasevent_src/get_rtas_event.c
|
||||
--- librtas-2.0.2/librtasevent_src/get_rtas_event.c.me 2021-03-25 11:26:19.754142871 +0100
|
||||
+++ librtas-2.0.2/librtasevent_src/get_rtas_event.c 2021-03-25 11:29:24.322686995 +0100
|
||||
@ -128,9 +76,10 @@ diff -up librtas-2.0.2/librtas_src/syscall_rmo.c.me librtas-2.0.2/librtas_src/sy
|
||||
if (bits != ((1 << n_pages) - 1)) {
|
||||
dbg("Invalid region [0x%x, 0x%zx]\n", phys_addr, size);
|
||||
return RTAS_IO_ASSERT;
|
||||
diff -up librtas-2.0.2/librtasevent_src/rtas_srcfru.c.me librtas-2.0.2/librtasevent_src/rtas_srcfru.c
|
||||
--- librtas-2.0.2/librtasevent_src/rtas_srcfru.c.me 2021-03-26 08:52:29.399602640 +0100
|
||||
+++ librtas-2.0.2/librtasevent_src/rtas_srcfru.c 2021-03-26 08:52:38.501720153 +0100
|
||||
diff --git a/librtasevent_src/rtas_srcfru.c b/librtasevent_src/rtas_srcfru.c
|
||||
index 23c8584..a2eac9a 100644
|
||||
--- a/librtasevent_src/rtas_srcfru.c
|
||||
+++ b/librtasevent_src/rtas_srcfru.c
|
||||
@@ -74,13 +74,13 @@ parse_fru_id_scn(struct rtas_event *re)
|
||||
re->offset += RE_FRU_HDR_SZ;
|
||||
|
||||
@ -149,3 +98,44 @@ diff -up librtas-2.0.2/librtasevent_src/rtas_srcfru.c.me librtas-2.0.2/librtasev
|
||||
}
|
||||
|
||||
if (fruid_has_ccin(fru_id)) {
|
||||
@@ -238,9 +238,10 @@ parse_src_scn(struct rtas_event *re)
|
||||
|
||||
add_re_scn(re, src, re_scn_id(&src_raw->v6hdr));
|
||||
|
||||
- if (!src_subscns_included(src))
|
||||
+ if (!src_subscns_included(src)) {
|
||||
+ free (src_raw);
|
||||
return 0;
|
||||
-
|
||||
+ }
|
||||
rtas_copy( (char *) src_raw + RE_SRC_SCN_SZ + 4, re, RE_SRC_SUBSCN_SZ);
|
||||
|
||||
src->subscn_id = src_raw->subscn_id;
|
||||
@@ -251,6 +252,7 @@ parse_src_scn(struct rtas_event *re)
|
||||
total_len = RE_SRC_SUBSCN_SZ;
|
||||
|
||||
last_fru = NULL;
|
||||
+ free(src_raw);
|
||||
|
||||
do {
|
||||
uint32_t fru_len, fru_end;
|
||||
@@ -288,6 +290,7 @@ parse_src_scn(struct rtas_event *re)
|
||||
|
||||
if (cur_fruhdr == NULL) {
|
||||
cleanup_rtas_event(re);
|
||||
+ free(fru);
|
||||
return -1;
|
||||
}
|
||||
|
||||
diff --git a/librtasevent_src/rtas_vend.c b/librtasevent_src/rtas_vend.c
|
||||
index 6fa717e..2814726 100644
|
||||
--- a/librtasevent_src/rtas_vend.c
|
||||
+++ b/librtasevent_src/rtas_vend.c
|
||||
@@ -116,6 +116,7 @@ parse_vend_errlog_scn(struct rtas_event *re)
|
||||
ve->vendor_data = malloc(ve->vendor_data_sz);
|
||||
if (ve->vendor_data == NULL) {
|
||||
errno = ENOMEM;
|
||||
+ free(ve);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
Summary: Libraries to provide access to RTAS calls and RTAS events
|
||||
Name: librtas
|
||||
Version: 2.0.2
|
||||
Release: 8%{?dist}
|
||||
Release: 9%{?dist}
|
||||
URL: https://github.com/nfont/librtas
|
||||
License: LGPL
|
||||
|
||||
@ -68,6 +68,9 @@ rm -f %{buildroot}/%{_docdir}/librtas/*
|
||||
%{_includedir}/librtasevent_v6.h
|
||||
|
||||
%changelog
|
||||
* Tue Apr 06 2021 Than Ngo <than@redhat.com> - 2.0.2-9
|
||||
- improve coverity fix
|
||||
|
||||
* Fri Mar 26 2021 Than Ngo <than@redhat.com> - 2.0.2-8
|
||||
- Fix coverity issues
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user