diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2009-03-10 10:17:13 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2009-04-16 15:15:00 +0300 |
commit | 8ff274f963947a9886b2ab8d119cd933edbb86d8 (patch) | |
tree | 2f1d6c592eef933552b30a95ff67bdf05c2f8e1c | |
parent | cdb64dac0bd7ea51f869143cd024c2ce4ef07e59 (diff) | |
download | rpm-8ff274f963947a9886b2ab8d119cd933edbb86d8.tar.gz |
Don't return data from headerGet() on regionSwab() failure
- callers dont expect to free data if headerGet() returns failure,
leaking memory
(cherry picked from commit 65f3e55d3592da8fb482b5344a28013029199115)
-rw-r--r-- | lib/header.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/header.c b/lib/header.c index fb9602be5..9455fc3d4 100644 --- a/lib/header.c +++ b/lib/header.c @@ -1179,6 +1179,10 @@ static int copyTdEntry(const indexEntry entry, rpmtd td, headerGetFlags flags) dataStart = (unsigned char *) memcpy(pe + ril, dataStart, rdl); rc = regionSwab(NULL, ril, 0, pe, dataStart, dataStart + rdl, 0); + /* don't return data on failure */ + if (rc < 0) { + td->data = _free(td->data); + } /* XXX 1 on success. */ rc = (rc < 0) ? 0 : 1; } else { |