commit 9322f737819a3d81088699b1d7fa667259245411
Author: Panu Matilainen <pmatilai@redhat.com>
Date: Tue May 19 10:26:50 2009 +0300
Don't mess up problem altNEVR in python ts.check() (rhbz#501068)
- the use of strrchr() silently casts away the const from the problem
set altNEVR string, which we then happily modify..
- similar to commit 62cc76e25cdfad78ac30bb28f626b474efdecddc
diff --git a/python/rpmts-py.c b/python/rpmts-py.c
index e56e001..9877fbc 100644
--- a/python/rpmts-py.c
+++ b/python/rpmts-py.c
@@ -365,7 +365,7 @@ fprintf(stderr, "*** rpmts_Check(%p) ts %p cb %p\n", s, s->ts, cbInfo.cb);
/* XXX TODO: rpmlib >= 4.0.3 can return multiple suggested keys. */
while ((i = rpmpsNextIterator(psi)) >= 0) {
- const char * needsName;
+ char * altNEVR, * needsName;
char * byName, * byVersion, * byRelease, *byArch;
char * needsOP, * needsVersion;
rpmsenseFlags needsFlags, sense;
@@ -383,7 +383,7 @@ fprintf(stderr, "*** rpmts_Check(%p) ts %p cb %p\n", s, s->ts, cbInfo.cb);
key = rpmProblemGetKey(p);
- needsName = rpmProblemGetAltNEVR(p);
+ altNEVR = needsName = xstrdup(rpmProblemGetAltNEVR(p));
if (needsName[1] == ' ') {
sense = (needsName[0] == 'C')
? RPMDEP_SENSE_CONFLICTS : RPMDEP_SENSE_REQUIRES;
@@ -409,6 +409,7 @@ fprintf(stderr, "*** rpmts_Check(%p) ts %p cb %p\n", s, s->ts, cbInfo.cb);
PyList_Append(list, (PyObject *) cf);
Py_DECREF(cf);
free(byName);
+ free(altNEVR);
}
psi = rpmpsFreeIterator(psi);