[Rpm-maint] [rpm-software-management/rpm] 3 cleanup fixes (#359)

Alan Jenkins notifications at github.com
Wed Jan 15 17:12:21 UTC 2020


Bad reading, bad patch.  Sorry for the NULL pointer dereference.  I'm not sure, I might have mixed up somewhere with the different backends.

That said, the real problem could have been confusion about the code that calls closeEnv().  It doesn't seem to make sense to test if `rdb->db_dbenv` is NULL before calling closeEnv().  It suggests we're not sure if we've called openEnv() or not.  But if we're not sure, then how do we know whether to decrement `rdb->db_dbenv->refs` or not?

IOW, I think what I should have sent is:

```diff
diff --git a/lib/backend/ndb/glue.c b/lib/backend/ndb/glue.c
index 90c10f889..46e115846 100644
--- a/lib/backend/ndb/glue.c
+++ b/lib/backend/ndb/glue.c
@@ -74,8 +74,7 @@ static int ndb_Close(dbiIndex dbi, unsigned int flags)
 	rpmidxClose(dbi->dbi_db);
 	rpmlog(RPMLOG_DEBUG, "closed   db index       %s\n", dbi->dbi_file);
     }
-    if (rdb->db_dbenv)
-	closeEnv(rdb);
+    closeEnv(rdb);
     dbi->dbi_db = 0;
     return 0;
 }
```


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/359#issuecomment-574760188
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20200115/0bf85a55/attachment.html>


More information about the Rpm-maint mailing list