SOURCES: libtar-fix-memleak.patch (NEW) - kill memleak (from debian)

megabajt megabajt at pld-linux.org
Tue Aug 19 11:51:44 CEST 2008


Author: megabajt                     Date: Tue Aug 19 09:51:44 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- kill memleak (from debian)

---- Files affected:
SOURCES:
   libtar-fix-memleak.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/libtar-fix-memleak.patch
diff -u /dev/null SOURCES/libtar-fix-memleak.patch:1.1
--- /dev/null	Tue Aug 19 11:51:45 2008
+++ SOURCES/libtar-fix-memleak.patch	Tue Aug 19 11:51:39 2008
@@ -0,0 +1,69 @@
+diff -urN libtar-1.2.11/lib/extract.c libtar-1.2.11.new/lib/extract.c
+--- libtar-1.2.11/lib/extract.c	2003-03-03 00:58:07.000000000 +0100
++++ libtar-1.2.11.new/lib/extract.c	2008-08-19 11:46:58.000000000 +0200
+@@ -21,6 +21,7 @@
+ 
+ #ifdef STDC_HEADERS
+ # include <stdlib.h>
++# include <string.h>
+ #endif
+ 
+ #ifdef HAVE_UNISTD_H
+@@ -99,6 +100,7 @@
+ {
+ 	int i;
+ 	linkname_t *lnp;
++	char *pathname;
+ 
+ 	if (t->options & TAR_NOOVERWRITE)
+ 	{
+@@ -140,12 +142,14 @@
+ 	lnp = (linkname_t *)calloc(1, sizeof(linkname_t));
+ 	if (lnp == NULL)
+ 		return -1;
+-	strlcpy(lnp->ln_save, th_get_pathname(t), sizeof(lnp->ln_save));
++	pathname = th_get_pathname(t);
++	strlcpy(lnp->ln_save, pathname, sizeof(lnp->ln_save));
+ 	strlcpy(lnp->ln_real, realname, sizeof(lnp->ln_real));
+ #ifdef DEBUG
+ 	printf("tar_extract_file(): calling libtar_hash_add(): key=\"%s\", "
+-	       "value=\"%s\"\n", th_get_pathname(t), realname);
++	       "value=\"%s\"\n", pathname, realname);
+ #endif
++	free(pathname);
+ 	if (libtar_hash_add(t->h, lnp) != 0)
+ 		return -1;
+ 
+diff -urN libtar-1.2.11/lib/output.c libtar-1.2.11.new/lib/output.c
+--- libtar-1.2.11/lib/output.c	2003-01-07 02:41:00.000000000 +0100
++++ libtar-1.2.11.new/lib/output.c	2008-08-19 11:46:58.000000000 +0200
+@@ -71,6 +71,7 @@
+ 	char groupname[_POSIX_LOGIN_NAME_MAX];
+ 	time_t mtime;
+ 	struct tm *mtm;
++	char *pathname;
+ 
+ #ifdef HAVE_STRFTIME
+ 	char timebuf[18];
+@@ -114,7 +115,9 @@
+ 	       mtm->tm_mday, mtm->tm_hour, mtm->tm_min, mtm->tm_year + 1900);
+ #endif
+ 
+-	printf(" %s", th_get_pathname(t));
++	pathname = th_get_pathname(t);
++	printf(" %s", pathname);
++	free(pathname);
+ 
+ 	if (TH_ISSYM(t) || TH_ISLNK(t))
+ 	{
+diff -urN libtar-1.2.11/lib/wrapper.c libtar-1.2.11.new/lib/wrapper.c
+--- libtar-1.2.11/lib/wrapper.c	2003-01-07 02:41:00.000000000 +0100
++++ libtar-1.2.11.new/lib/wrapper.c	2008-08-19 11:46:58.000000000 +0200
+@@ -76,6 +76,7 @@
+ 			snprintf(buf, sizeof(buf), "%s/%s", prefix, filename);
+ 		else
+ 			strlcpy(buf, filename, sizeof(buf));
++		free(filename);
+ #ifdef DEBUG
+ 		printf("    tar_extract_all(): calling tar_extract_file(t, "
+ 		       "\"%s\")\n", buf);
================================================================


More information about the pld-cvs-commit mailing list