From e44a6a64f8753812198260404901c256a1aa569c Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Tue, 19 May 2009 10:26:50 +0300 Subject: [PATCH] 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 (cherry picked from commit 9322f737819a3d81088699b1d7fa667259245411) --- python/rpmts-py.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python/rpmts-py.c b/python/rpmts-py.c index 84da9cb..115cbbe 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); -- 2.7.4