[poppler] poppler/glib: poppler-document.cc,1.37,1.37.2.1
Albert Astals Cid
aacid at kemper.freedesktop.org
Sun Jan 28 07:36:13 PST 2007
Update of /cvs/poppler/poppler/glib
In directory kemper:/tmp/cvs-serv9669/glib
Modified Files:
Tag: POPPLER_0_5_X
poppler-document.cc
Log Message:
* glib/poppler-document.cc: Plug memory leak in poppler-document. Patch by Carlos Garcia Campos <carlosgc at gnome.org>
Index: poppler-document.cc
===================================================================
RCS file: /cvs/poppler/poppler/glib/poppler-document.cc,v
retrieving revision 1.37
retrieving revision 1.37.2.1
diff -u -d -r1.37 -r1.37.2.1
--- poppler-document.cc 19 May 2006 22:12:38 -0000 1.37
+++ poppler-document.cc 28 Jan 2007 15:36:11 -0000 1.37.2.1
@@ -164,6 +164,7 @@
filename = g_filename_from_uri (uri, NULL, error);
if (filename != NULL) {
GooString *fname = new GooString (filename);
+ g_free (filename);
retval = document->doc->saveAs (fname);
@@ -412,7 +413,7 @@
GooString *goo_value;
int year, mon, day, hour, min, sec;
int scanned_items;
- struct tm *time;
+ struct tm time;
gchar *date_string, *ds;
GTime result;
@@ -463,26 +464,23 @@
year = century * 100 + years_since_1900;
}
- time = g_new0 (struct tm, 1);
-
- time->tm_year = year - 1900;
- time->tm_mon = mon - 1;
- time->tm_mday = day;
- time->tm_hour = hour;
- time->tm_min = min;
- time->tm_sec = sec;
- time->tm_wday = -1;
- time->tm_yday = -1;
- time->tm_isdst = -1; /* 0 = DST off, 1 = DST on, -1 = don't know */
+ time.tm_year = year - 1900;
+ time.tm_mon = mon - 1;
+ time.tm_mday = day;
+ time.tm_hour = hour;
+ time.tm_min = min;
+ time.tm_sec = sec;
+ time.tm_wday = -1;
+ time.tm_yday = -1;
+ time.tm_isdst = -1; /* 0 = DST off, 1 = DST on, -1 = don't know */
/* compute tm_wday and tm_yday and check date */
- if (mktime (time) == (time_t) - 1) {
+ result = mktime (&time);
+ if (result == (time_t) - 1) {
obj.free ();
g_free (ds);
return;
- } else {
- result = mktime (time);
- }
+ }
obj.free ();
g_free (ds);
More information about the poppler
mailing list