diff options
| author | Mark Wielaard <[email protected]> | 2016-04-14 21:02:39 +0200 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2016-04-14 21:08:30 +0200 |
| commit | f7f45ed580029d80e6cf5bcfa5d5445af797e363 (patch) | |
| tree | ac5c524b273c5ebe2ecc6473ccc0eb4c4fba8c41 /libelf/elf_compress.c | |
| parent | 836a16fe5b5bab4a3afe2c991c104652775ce3a3 (diff) | |
libelf: Fix memory leak when zlib deflateInit fails in elf_compress.
On error we return NULL, not out_buf. So make sure to not leak it.
Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'libelf/elf_compress.c')
| -rw-r--r-- | libelf/elf_compress.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/libelf/elf_compress.c b/libelf/elf_compress.c index 4c7c35e1..10574eae 100644 --- a/libelf/elf_compress.c +++ b/libelf/elf_compress.c @@ -117,6 +117,7 @@ __libelf_compress (Elf_Scn *scn, size_t hsize, int ei_data, int zrc = deflateInit (&z, Z_BEST_COMPRESSION); if (zrc != Z_OK) { + free (out_buf); __libelf_seterrno (ELF_E_COMPRESS_ERROR); return NULL; } |
