aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPer Øyvind Karlsen <peroyvind@mandriva.org>2008-02-28 11:04:31 +0000
committerPer Øyvind Karlsen <peroyvind@mandriva.org>2008-02-28 11:04:31 +0000
commite5728c5f01e551e6056936ca167d33c63d28410d (patch)
tree20ef27ec1486fac7cf502e35fa3d1ad493aaaa1d
parent16e00f6182f9306ec076aa949660b3caaae7e1af (diff)
downloadperl-URPM-e5728c5f01e551e6056936ca167d33c63d28410d.tar
perl-URPM-e5728c5f01e551e6056936ca167d33c63d28410d.tar.gz
perl-URPM-e5728c5f01e551e6056936ca167d33c63d28410d.tar.bz2
perl-URPM-e5728c5f01e551e6056936ca167d33c63d28410d.tar.xz
perl-URPM-e5728c5f01e551e6056936ca167d33c63d28410d.zip
fix double _free of msg in headerWrite() & headerRead()
do rpmlog for headerWrite() & headerRead() drop unused variable in cointainer for headerNextIterator()
-rw-r--r--rpm5compat.h14
1 files changed, 6 insertions, 8 deletions
diff --git a/rpm5compat.h b/rpm5compat.h
index e4b349d..71b5869 100644
--- a/rpm5compat.h
+++ b/rpm5compat.h
@@ -80,7 +80,6 @@ static int headerNextIterator(HeaderIterator hi, hTAG_t tag, hTYP_t type, hPTR_t
HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
he->tag = (rpmTag)tag;
- he->p.str = (char*)p;
return headerNext(hi, he, 0);
}
@@ -105,14 +104,12 @@ void * headerFreeData(const void * data, rpmTagType type) {
static int headerWrite(void * _fd, Header h, enum hMagic magicp) {
const char item[] = "Header";
+ const char * fn = NULL;
const char * msg = NULL;
rpmRC rc = rpmpkgWrite(item, _fd, h, &msg);
if (rc != RPMRC_OK) {
-/* rpmlog(RPMLOG_ERR, "%s: %s: %s\n", sigtarget, item,
- (msg && *msg ? msg : "write failed\n"));*/
- msg = _free(msg);
+ rpmlog(RPMLOG_ERR, "%s: %s: %s\n", fn, item, msg);
rc = RPMRC_FAIL;
-// goto exit;
}
msg = _free(msg);
return rc;
@@ -120,11 +117,12 @@ static int headerWrite(void * _fd, Header h, enum hMagic magicp) {
static int headerRead(void * _fd, enum hMagic magicp) {
const char item[] = "Header";
- Header nh = NULL;
+ Header h = NULL;
+ const char * fn = NULL;
const char * msg = NULL;
- rpmRC rc = rpmpkgRead(item, _fd, &nh, &msg);
+ rpmRC rc = rpmpkgRead(item, _fd, &h, &msg);
if (rc != RPMRC_OK) {
- msg = _free(msg);
+ rpmlog(RPMLOG_ERR, "%s: %s: %s\n", fn, item, msg);
rc = RPMRC_FAIL;
}
msg = _free(msg);