Panu Matilainen 66621c
changeset:   6070:7ca081cd83d8
Panu Matilainen 66621c
tag:         tip
Panu Matilainen 66621c
user:        Panu Matilainen <pmatilai@redhat.com>
Panu Matilainen 66621c
date:        Thu Jun 28 14:44:48 2007 +0300
Panu Matilainen 66621c
summary:     Remember to free up match iterators (rhbz#246044)
Panu Matilainen 66621c
Panu Matilainen 66621c
diff -r a468a8443652 -r 7ca081cd83d8 lib/query.c
Panu Matilainen 66621c
--- a/lib/query.c	Wed Jun 27 16:29:16 2007 +0300
Panu Matilainen 66621c
+++ b/lib/query.c	Thu Jun 28 14:44:48 2007 +0300
Panu Matilainen 66621c
@@ -680,10 +680,12 @@ int rpmQueryVerify(QVA_t qva, rpmts ts, 
Panu Matilainen 66621c
     case RPMQV_PACKAGE:
Panu Matilainen 66621c
     {
Panu Matilainen 66621c
 	int matches = 0;
Panu Matilainen 66621c
-	qva->qva_mi = rpmtsInitIterator(ts, RPMDBI_LABEL, arg, 0);
Panu Matilainen 66621c
-	while (rpmdbNextIterator(qva->qva_mi) != NULL) {
Panu Matilainen 66621c
+	rpmdbMatchIterator mi;
Panu Matilainen 66621c
+	mi = rpmtsInitIterator(ts, RPMDBI_LABEL, arg, 0);
Panu Matilainen 66621c
+	while (rpmdbNextIterator(mi) != NULL) {
Panu Matilainen 66621c
 	    matches++;
Panu Matilainen 66621c
 	}
Panu Matilainen 66621c
+	rpmdbFreeIterator(mi);
Panu Matilainen 66621c
 	if (! matches) {
Panu Matilainen 66621c
 	    rpmError(RPMERR_QUERYINFO, _("package %s is not installed\n"), arg);
Panu Matilainen 66621c
 	    res = 1;
Panu Matilainen 66621c