[poppler] poppler/glib: poppler-document.cc,1.38,1.39
Albert Astals Cid
aacid at kemper.freedesktop.org
Sun Jan 28 07:36:11 PST 2007
Update of /cvs/poppler/poppler/glib
In directory kemper:/tmp/cvs-serv9679/glib
Modified Files:
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.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- poppler-document.cc 29 Dec 2006 04:12:40 -0000 1.38
+++ poppler-document.cc 28 Jan 2007 15:36:09 -0000 1.39
@@ -217,6 +217,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);
@@ -465,7 +466,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;
@@ -516,26 +517,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