From: Panu Matilainen Date: Tue, 19 May 2009 07:26:50 +0000 (+0300) Subject: Don't mess up problem altNEVR in python ts.check() (rhbz#501068) X-Git-Tag: rpm-4.7.1-release~38 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e44a6a64f8753812198260404901c256a1aa569c;p=platform%2Fupstream%2Frpm.git 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) --- 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);