summaryrefslogtreecommitdiff
path: root/src/rules.c
diff options
context:
space:
mode:
authorMichael Schroeder <mls@suse.de>2012-12-18 13:36:53 +0100
committerMichael Schroeder <mls@suse.de>2012-12-18 13:36:53 +0100
commitaa7796db956c80ceb0975afef216a98c800ad592 (patch)
tree604f8f2fad2887e84f2e9da24f082349eaba944c /src/rules.c
parent5e788af275c4e1fae0844542d03f8a02ad3ab88e (diff)
downloadlibsolv-aa7796db956c80ceb0975afef216a98c800ad592.tar.gz
libsolv-aa7796db956c80ceb0975afef216a98c800ad592.tar.bz2
libsolv-aa7796db956c80ceb0975afef216a98c800ad592.zip
don't access r->p after solver_addrule is called, as it may realloc the rules
Thanks valgrind!
Diffstat (limited to 'src/rules.c')
-rw-r--r--src/rules.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/rules.c b/src/rules.c
index 9b9b8aa..f6facf4 100644
--- a/src/rules.c
+++ b/src/rules.c
@@ -2414,14 +2414,15 @@ solver_addchoicerules(Solver *solv)
if (i == q.count)
continue; /* already added that one */
}
-
d = q.count ? pool_queuetowhatprovides(pool, &q) : 0;
- solver_addrule(solv, r->p, d);
- queue_push(&solv->weakruleq, solv->nrules - 1);
- solv->choicerules_ref[solv->nrules - 1 - solv->choicerules] = rid;
+
lastaddedp = r->p;
lastaddedd = d;
lastaddedcnt = q.count;
+
+ solver_addrule(solv, r->p, d);
+ queue_push(&solv->weakruleq, solv->nrules - 1);
+ solv->choicerules_ref[solv->nrules - 1 - solv->choicerules] = rid;
#if 0
printf("OLD ");
solver_printrule(solv, SOLV_DEBUG_RESULT, solv->rules + rid);