]> git.pld-linux.org Git - packages/php.git/commitdiff
- fix for bug #46889, memory leak in strtotime()
authorhawk <hawk@pld-linux.org>
Thu, 12 Feb 2009 15:12:54 +0000 (15:12 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    php-strtotime-memleak.patch -> 1.1

php-strtotime-memleak.patch [new file with mode: 0644]

diff --git a/php-strtotime-memleak.patch b/php-strtotime-memleak.patch
new file mode 100644 (file)
index 0000000..9f6ab1b
--- /dev/null
@@ -0,0 +1,98 @@
+diff -urN php-5.2.8/ext/date/lib/parse_date.c php5.2-200902121330/ext/date/lib/parse_date.c
+--- php-5.2.8/ext/date/lib/parse_date.c        2008-12-07 20:31:16.000000000 +0100
++++ php5.2-200902121330/ext/date/lib/parse_date.c      2009-02-12 14:51:26.000000000 +0100
+@@ -22395,7 +22395,7 @@
+ void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options)
+ {
+-      if (!(options && TIMELIB_OVERRIDE_TIME) && parsed->have_date && !parsed->have_time) {
++      if (!(options & TIMELIB_OVERRIDE_TIME) && parsed->have_date && !parsed->have_time) {
+               parsed->h = 0;
+               parsed->i = 0;
+               parsed->s = 0;
+@@ -22415,7 +22415,7 @@
+               parsed->tz_abbr = now->tz_abbr ? strdup(now->tz_abbr) : NULL;
+       }
+       if (!parsed->tz_info) {
+-              parsed->tz_info = now->tz_info ? timelib_tzinfo_clone(now->tz_info) : NULL;
++              parsed->tz_info = now->tz_info ? (!(options & TIMELIB_NO_CLONE) ? timelib_tzinfo_clone(now->tz_info) : now->tz_info) : NULL;
+       }
+       if (parsed->zone_type == 0 && now->zone_type != 0) {
+               parsed->zone_type = now->zone_type;
+diff -urN php-5.2.8/ext/date/lib/parse_date.c.orig php5.2-200902121330/ext/date/lib/parse_date.c.orig
+--- php-5.2.8/ext/date/lib/parse_date.c.orig   2008-12-07 20:31:16.000000000 +0100
++++ php5.2-200902121330/ext/date/lib/parse_date.c.orig 2009-02-12 14:51:26.000000000 +0100
+@@ -22483,7 +22483,7 @@
+ void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options)
+ {
+-      if (!(options && TIMELIB_OVERRIDE_TIME) && parsed->have_date && !parsed->have_time) {
++      if (!(options & TIMELIB_OVERRIDE_TIME) && parsed->have_date && !parsed->have_time) {
+               parsed->h = 0;
+               parsed->i = 0;
+               parsed->s = 0;
+@@ -22503,7 +22503,7 @@
+               parsed->tz_abbr = now->tz_abbr ? strdup(now->tz_abbr) : NULL;
+       }
+       if (!parsed->tz_info) {
+-              parsed->tz_info = now->tz_info ? timelib_tzinfo_clone(now->tz_info) : NULL;
++              parsed->tz_info = now->tz_info ? (!(options & TIMELIB_NO_CLONE) ? timelib_tzinfo_clone(now->tz_info) : now->tz_info) : NULL;
+       }
+       if (parsed->zone_type == 0 && now->zone_type != 0) {
+               parsed->zone_type = now->zone_type;
+diff -urN php-5.2.8/ext/date/lib/parse_date.re php5.2-200902121330/ext/date/lib/parse_date.re
+--- php-5.2.8/ext/date/lib/parse_date.re       2008-10-26 12:27:32.000000000 +0100
++++ php5.2-200902121330/ext/date/lib/parse_date.re     2008-12-18 16:43:49.000000000 +0100
+@@ -1619,7 +1619,7 @@
+ void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options)
+ {
+-      if (!(options && TIMELIB_OVERRIDE_TIME) && parsed->have_date && !parsed->have_time) {
++      if (!(options & TIMELIB_OVERRIDE_TIME) && parsed->have_date && !parsed->have_time) {
+               parsed->h = 0;
+               parsed->i = 0;
+               parsed->s = 0;
+@@ -1639,7 +1639,7 @@
+               parsed->tz_abbr = now->tz_abbr ? strdup(now->tz_abbr) : NULL;
+       }
+       if (!parsed->tz_info) {
+-              parsed->tz_info = now->tz_info ? timelib_tzinfo_clone(now->tz_info) : NULL;
++              parsed->tz_info = now->tz_info ? (!(options & TIMELIB_NO_CLONE) ? timelib_tzinfo_clone(now->tz_info) : now->tz_info) : NULL;
+       }
+       if (parsed->zone_type == 0 && now->zone_type != 0) {
+               parsed->zone_type = now->zone_type;
+diff -urN php-5.2.8/ext/date/lib/timelib.h php5.2-200902121330/ext/date/lib/timelib.h
+--- php-5.2.8/ext/date/lib/timelib.h   2008-02-22 10:48:18.000000000 +0100
++++ php5.2-200902121330/ext/date/lib/timelib.h 2008-12-31 12:46:14.000000000 +0100
+@@ -28,6 +28,7 @@
+ #define TIMELIB_NONE             0x00
+ #define TIMELIB_OVERRIDE_TIME    0x01
++#define TIMELIB_NO_CLONE         0x02
+ #define TIMELIB_SPECIAL_WEEKDAY  0x01
+diff -urN php-5.2.8/ext/date/lib/timelib_structs.h php5.2-200902121330/ext/date/lib/timelib_structs.h
+--- php-5.2.8/ext/date/lib/timelib_structs.h   2007-12-31 08:20:05.000000000 +0100
++++ php5.2-200902121330/ext/date/lib/timelib_structs.h 2008-12-31 12:46:14.000000000 +0100
+@@ -16,7 +16,7 @@
+ #ifndef __TIMELIB_STRUCTS_H__
+ #define __TIMELIB_STRUCTS_H__
+-#include <timelib_config.h>
++#include "timelib_config.h"
+ #ifdef HAVE_SYS_TYPES_H
+ #include <sys/types.h>
+diff -urN php-5.2.8/ext/date/php_date.c php5.2-200902121330/ext/date/php_date.c
+--- php-5.2.8/ext/date/php_date.c      2008-12-02 19:01:57.000000000 +0100
++++ php5.2-200902121330/ext/date/php_date.c    2008-12-31 12:46:14.000000000 +0100
+@@ -1143,7 +1143,7 @@
+       t = timelib_strtotime(times, time_len, &error, DATE_TIMEZONEDB);
+       error1 = error->error_count;
+       timelib_error_container_dtor(error);
+-      timelib_fill_holes(t, now, 0);
++      timelib_fill_holes(t, now, TIMELIB_NO_CLONE);
+       timelib_update_ts(t, tzi);
+       ts = timelib_date_to_int(t, &error2);
This page took 0.974098 seconds and 4 git commands to generate.