The following commit has been merged in the master branch:
commit 6f5374204b4080ed22dc4efc68e57a24b58018d7
Author: Guillem Jover <[email protected]>
Date: Tue Nov 1 22:37:22 2011 +0100
libdpkg: Do not leak every tar_entry name and linkname members
The only free()ed members were the last ones.
diff --git a/TODO b/TODO
index 5ff4bae..2f3b429 100644
--- a/TODO
+++ b/TODO
@@ -52,7 +52,6 @@ TODO
- Handle instdir '/' separator consistently.
- Check if caching selinux context for second call is possible.
- Add missing newlines in --version output.
- - Fix leak on tar_extract (name, linkname).
- Handle symlinks in statcmd.c statdb_node_apply().
- Fix dpkg termination on SIGPIPE from status-fd.
diff --git a/debian/changelog b/debian/changelog
index 5a47a25..d7a1af6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -26,6 +26,7 @@ dpkg (1.16.2) UNRELEASED; urgency=low
using the ‘--warning=no-timestamp’ option. Closes: 642802
* Do not segfault on GNU/Linux when dpkg cannot retrieve the block size
for the filesystem containing the info database. LP: #872734
+ * Fix two memory leaks per tar entry in the tar extractor used on unpack.
[ Raphaël Hertzog ]
* Update Dpkg::Shlibs to look into multiarch paths when cross-building
diff --git a/lib/dpkg/tarfn.c b/lib/dpkg/tarfn.c
index 680ddd8..ead7d34 100644
--- a/lib/dpkg/tarfn.c
+++ b/lib/dpkg/tarfn.c
@@ -308,6 +308,7 @@ tar_extractor(void *ctx, const struct tar_operations *ops)
errno = 0;
status = -1;
}
+ tar_entry_destroy(&h);
break;
}
if (h.type != tar_filetype_gnu_longlink &&
@@ -326,6 +327,7 @@ tar_extractor(void *ctx, const struct tar_operations *ops)
/* Indicates broken tarfile: “Bad header data”. */
errno = 0;
status = -1;
+ tar_entry_destroy(&h);
break;
}
@@ -378,6 +380,7 @@ tar_extractor(void *ctx, const struct tar_operations *ops)
errno = 0;
status = -1;
}
+ tar_entry_destroy(&h);
if (status != 0)
/* Pass on status from coroutine. */
break;
@@ -391,7 +394,6 @@ tar_extractor(void *ctx, const struct tar_operations *ops)
free(symlink_head);
symlink_head = symlink_node;
}
- tar_entry_destroy(&h);
if (status > 0) {
/* Indicates broken tarfile: “Read partial header record”. */
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]