diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2007-12-15 11:47:47 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2007-12-15 11:47:47 +0200 |
commit | b4588a1202783dd9bbee594aa5aea022ccdd3fc9 (patch) | |
tree | 01c212b49497df5241700db4f6cda987b7448df7 | |
parent | 1a0a12cf159a05471be62016a318d0653ae30ff5 (diff) | |
download | librpm-tizen-b4588a1202783dd9bbee594aa5aea022ccdd3fc9.tar.gz librpm-tizen-b4588a1202783dd9bbee594aa5aea022ccdd3fc9.tar.bz2 librpm-tizen-b4588a1202783dd9bbee594aa5aea022ccdd3fc9.zip |
Remove bogus const from rpmProblemString() return type
- its malloced so it needs to be freed
- fix all users to actually free
-rw-r--r-- | lib/rpmps.c | 2 | ||||
-rw-r--r-- | lib/rpmps.h | 2 | ||||
-rw-r--r-- | lib/verify.c | 4 | ||||
-rw-r--r-- | python/rpmps-py.c | 8 | ||||
-rw-r--r-- | python/rpmts-py.c | 4 |
5 files changed, 14 insertions, 6 deletions
diff --git a/lib/rpmps.c b/lib/rpmps.c index bb78e51db..68f740542 100644 --- a/lib/rpmps.c +++ b/lib/rpmps.c @@ -296,7 +296,7 @@ unsigned long rpmProblemGetLong(const rpmProblem p) return (p->ulong1); } -const char * rpmProblemString(const rpmProblem prob) +char * rpmProblemString(const rpmProblem prob) { const char * pkgNEVR = (prob->pkgNEVR ? prob->pkgNEVR : "?pkgNEVR?"); const char * altNEVR = (prob->altNEVR ? prob->altNEVR : "? ?altNEVR?"); diff --git a/lib/rpmps.h b/lib/rpmps.h index 699abd9c5..1d53d585a 100644 --- a/lib/rpmps.h +++ b/lib/rpmps.h @@ -132,7 +132,7 @@ unsigned long rpmProblemGetLong(const rpmProblem prob); * @param prob rpm problem * @return formatted string (malloc'd) */ -extern const char * rpmProblemString(const rpmProblem prob); +extern char * rpmProblemString(const rpmProblem prob); /** \ingroup rpmps * Unreference a problem set instance. diff --git a/lib/verify.c b/lib/verify.c index bb3361563..df01858b3 100644 --- a/lib/verify.c +++ b/lib/verify.c @@ -371,7 +371,9 @@ static int verifyDependencies(QVA_t qva, rpmts ts, free(nevra); while (rpmpsNextIterator(psi) >= 0) { rpmProblem p = rpmpsGetProblem(psi); - rpmlog(RPMLOG_NOTICE, "\t%s\n", rpmProblemString(p)); + char * ps = rpmProblemString(p); + rpmlog(RPMLOG_NOTICE, "\t%s\n", ps); + free(ps); rc++; } } diff --git a/python/rpmps-py.c b/python/rpmps-py.c index df20140d9..4a592369c 100644 --- a/python/rpmps-py.c +++ b/python/rpmps-py.c @@ -68,7 +68,9 @@ fprintf(stderr, "*** rpmps_iternext(%p) ps %p psi %p\n", s, s->ps, s->psi); /* If more to do, return a problem set string. */ if (rpmpsNextIterator(s->psi) >= 0) { - result = Py_BuildValue("s", rpmProblemString(rpmpsGetProblem(s->psi))); + char * ps = rpmProblemString(rpmpsGetProblem(s->psi)); + result = Py_BuildValue("s", ps); + free(ps); } else { s->psi = rpmpsFreeIterator(s->psi); } @@ -148,7 +150,9 @@ rpmps_subscript(rpmpsObject * s, PyObject * key) psi = rpmpsInitIterator(s->ps); while ((i = rpmpsNextIterator(psi)) >= 0) { if (i == ix) { - result = Py_BuildValue("s", rpmProblemString(rpmpsGetProblem(psi))); + char * ps = rpmProblemString(rpmpsGetProblem(psi)); + result = Py_BuildValue("s", ps); + free(ps); break; } } diff --git a/python/rpmts-py.c b/python/rpmts-py.c index 8cb964055..b60ef8f40 100644 --- a/python/rpmts-py.c +++ b/python/rpmts-py.c @@ -1139,11 +1139,13 @@ fprintf(stderr, "*** rpmts_Run(%p) ts %p ignore %x\n", s, s->ts, s->ignoreSet); psi = rpmpsInitIterator(ps); while (rpmpsNextIterator(psi) >= 0) { rpmProblem p = rpmpsGetProblem(psi); - PyObject * prob = Py_BuildValue("s(isN)", rpmProblemString(p), + char * ps = rpmProblemString(p); + PyObject * prob = Py_BuildValue("s(isN)", ps, rpmProblemGetType(p), rpmProblemGetStr(p), PyLong_FromLongLong(rpmProblemGetLong(p))); PyList_Append(list, prob); + free(ps); Py_DECREF(prob); } |