From: Michael Schroeder Date: Wed, 27 Jun 2018 15:27:44 +0000 (+0200) Subject: Fix fp double close, work around some false positives from covscan X-Git-Tag: 0.6.35~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f95fad5220b4d39a610a45d92b0067588a91db8;p=thirdparty%2Flibsolv.git Fix fp double close, work around some false positives from covscan --- diff --git a/ext/repo_rpmdb.c b/ext/repo_rpmdb.c index 1c11138c..74c09c06 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;