[Pinfo-devel] r73 - pinfo/branches/cxx/src
Nathanael Nerode
neroden-guest at costa.debian.org
Mon Aug 29 08:22:00 UTC 2005
Author: neroden-guest
Date: 2005-08-29 08:21:59 +0000 (Mon, 29 Aug 2005)
New Revision: 73
Modified:
pinfo/branches/cxx/src/filehandling_functions.cxx
Log:
Fix memory leak detected by valgrind. (Of course, we'll fix more if
we finish the std::string conversion. But this gets us to a valgrind-clean
run of launch-then-quit.)
Modified: pinfo/branches/cxx/src/filehandling_functions.cxx
===================================================================
--- pinfo/branches/cxx/src/filehandling_functions.cxx 2005-08-29 08:00:34 UTC (rev 72)
+++ pinfo/branches/cxx/src/filehandling_functions.cxx 2005-08-29 08:21:59 UTC (rev 73)
@@ -522,7 +522,6 @@
{
FILE *id = NULL;
char *tmpfilename;
- int *fileendentries = (int*)xmalloc(infopathcount * sizeof(int));
int dir_found = 0;
int dircount = 0;
struct stat status;
@@ -538,6 +537,7 @@
tmpfilename = tmpfilename1; /* later we will refere only to tmp1 */
}
+ int *fileendentries = (int*)xmalloc(infopathcount * sizeof(int));
for (int i = 0; i < infopathcount; i++) { /* go through all paths */
int lang_found = 0;
for (int k = 0; k <= 1; k++) { /* Two passes: with and without LANG */
@@ -559,7 +559,6 @@
bufstr += "/dir";
}
- /* FIXME: Duplicated code */
for (int j = 0; j < SuffixesNumber; j++) { /* go through all suffixes */
string bufstr_with_suffix;
bufstr_with_suffix = bufstr;
@@ -626,13 +625,14 @@
}
fputc(INFO_TAG, id);
fputc('\n', id);
- xfree(fileendentries);
fclose(id);
id = fopen(tmpfilename, "r");
xfree(tmp);
+ xfree(fileendentries);
return id;
}
+ xfree(fileendentries);
return NULL;
}
More information about the Pinfo-devel
mailing list