]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Fix fp double close, work around some false positives from covscan
authorMichael Schroeder <mls@suse.de>
Wed, 27 Jun 2018 15:27:44 +0000 (17:27 +0200)
committerMichael Schroeder <mls@suse.de>
Wed, 27 Jun 2018 15:28:26 +0000 (17:28 +0200)
ext/repo_rpmdb.c
src/repo_solv.c
src/selection.c

index 1c11138c4252193d50a22e12ca33e89cc1360dc8..74c09c06de91910494cc874dc524a84cf4fb8e7b 100644 (file)
@@ -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)
index 2460e30a8576c43b2eae7d471315cdebe44ac1dd..034d2fab299493b379921629d88a379328f1d4da 100644 (file)
@@ -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;
 
index 6ca72e5d12202b416a1857c86a9b5ffeb26afb8e..d9d35e387d93e744addbdd265e96b0cf840cc77a 100644 (file)
@@ -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;