libsolv/0006-Fix-fp-double-close-work-around-some-false-positives.patch

59 lines
1.8 KiB
Diff
Raw Normal View History

From 3c29a0763b9e94eaad59972795c500ce07485929 Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Wed, 27 Jun 2018 17:27:44 +0200
Subject: [PATCH 6/6] Fix fp double close, work around some false positives
from covscan
(cherry picked from commit 2f95fad5220b4d39a610a45d92b0067588a91db8)
---
ext/repo_rpmdb.c | 5 +----
src/repo_solv.c | 2 +-
src/selection.c | 2 ++
3 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/ext/repo_rpmdb.c b/ext/repo_rpmdb.c
index ad221c32..ff1e32a1 100644
--- a/ext/repo_rpmdb.c
+++ b/ext/repo_rpmdb.c
@@ -1260,10 +1260,7 @@ headfromfp(struct rpmdbstate *state, const char *name, FILE *fp, unsigned char *
}
rpmhead = state->rpmhead;
if (fread(rpmhead->data, len, 1, fp) != 1)
- {
- fclose(fp);
- return pool_error(state->pool, 0, "%s: unexpected EOF", name);
- }
+ return pool_error(state->pool, 0, "%s: unexpected EOF", name);
if (chk1)
solv_chksum_add(chk1, rpmhead->data, len);
if (chk2)
diff --git a/src/repo_solv.c b/src/repo_solv.c
index 2460e30a..034d2fab 100644
--- a/src/repo_solv.c
+++ b/src/repo_solv.c
@@ -612,7 +612,7 @@ repo_add_solv(Repo *repo, FILE *fp, int flags)
unsigned int pfsize = read_u32(&data);
char *prefix = solv_malloc(pfsize);
char *pp = prefix;
- char *old_str = 0;
+ char *old_str = strsp;
char *dest = strsp;
int freesp = sizeid;
diff --git a/src/selection.c b/src/selection.c
index 6ca72e5d..d9d35e38 100644
--- a/src/selection.c
+++ b/src/selection.c
@@ -1444,6 +1444,8 @@ selection_make_matchdeps_common_limited(Pool *pool, Queue *selection, const char
return 0;
if (!name && !dep)
return 0;
+ if (name && dep)
+ return 0;
if ((flags & SELECTION_MATCH_DEPSTR) != 0)
flags &= ~SELECTION_REL;
--
2.18.0.rc2