]> git.pld-linux.org Git - packages/php.git/blob - php-strtotime-memleak.patch
- fix for bug #46889, memory leak in strtotime()
[packages/php.git] / php-strtotime-memleak.patch
1 diff -urN php-5.2.8/ext/date/lib/parse_date.c php5.2-200902121330/ext/date/lib/parse_date.c
2 --- php-5.2.8/ext/date/lib/parse_date.c 2008-12-07 20:31:16.000000000 +0100
3 +++ php5.2-200902121330/ext/date/lib/parse_date.c       2009-02-12 14:51:26.000000000 +0100
4 @@ -22395,7 +22395,7 @@
5  
6  void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options)
7  {
8 -       if (!(options && TIMELIB_OVERRIDE_TIME) && parsed->have_date && !parsed->have_time) {
9 +       if (!(options & TIMELIB_OVERRIDE_TIME) && parsed->have_date && !parsed->have_time) {
10                 parsed->h = 0;
11                 parsed->i = 0;
12                 parsed->s = 0;
13 @@ -22415,7 +22415,7 @@
14                 parsed->tz_abbr = now->tz_abbr ? strdup(now->tz_abbr) : NULL;
15         }
16         if (!parsed->tz_info) {
17 -               parsed->tz_info = now->tz_info ? timelib_tzinfo_clone(now->tz_info) : NULL;
18 +               parsed->tz_info = now->tz_info ? (!(options & TIMELIB_NO_CLONE) ? timelib_tzinfo_clone(now->tz_info) : now->tz_info) : NULL;
19         }
20         if (parsed->zone_type == 0 && now->zone_type != 0) {
21                 parsed->zone_type = now->zone_type;
22 diff -urN php-5.2.8/ext/date/lib/parse_date.c.orig php5.2-200902121330/ext/date/lib/parse_date.c.orig
23 --- php-5.2.8/ext/date/lib/parse_date.c.orig    2008-12-07 20:31:16.000000000 +0100
24 +++ php5.2-200902121330/ext/date/lib/parse_date.c.orig  2009-02-12 14:51:26.000000000 +0100
25 @@ -22483,7 +22483,7 @@
26  
27  void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options)
28  {
29 -       if (!(options && TIMELIB_OVERRIDE_TIME) && parsed->have_date && !parsed->have_time) {
30 +       if (!(options & TIMELIB_OVERRIDE_TIME) && parsed->have_date && !parsed->have_time) {
31                 parsed->h = 0;
32                 parsed->i = 0;
33                 parsed->s = 0;
34 @@ -22503,7 +22503,7 @@
35                 parsed->tz_abbr = now->tz_abbr ? strdup(now->tz_abbr) : NULL;
36         }
37         if (!parsed->tz_info) {
38 -               parsed->tz_info = now->tz_info ? timelib_tzinfo_clone(now->tz_info) : NULL;
39 +               parsed->tz_info = now->tz_info ? (!(options & TIMELIB_NO_CLONE) ? timelib_tzinfo_clone(now->tz_info) : now->tz_info) : NULL;
40         }
41         if (parsed->zone_type == 0 && now->zone_type != 0) {
42                 parsed->zone_type = now->zone_type;
43 diff -urN php-5.2.8/ext/date/lib/parse_date.re php5.2-200902121330/ext/date/lib/parse_date.re
44 --- php-5.2.8/ext/date/lib/parse_date.re        2008-10-26 12:27:32.000000000 +0100
45 +++ php5.2-200902121330/ext/date/lib/parse_date.re      2008-12-18 16:43:49.000000000 +0100
46 @@ -1619,7 +1619,7 @@
47  
48  void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options)
49  {
50 -       if (!(options && TIMELIB_OVERRIDE_TIME) && parsed->have_date && !parsed->have_time) {
51 +       if (!(options & TIMELIB_OVERRIDE_TIME) && parsed->have_date && !parsed->have_time) {
52                 parsed->h = 0;
53                 parsed->i = 0;
54                 parsed->s = 0;
55 @@ -1639,7 +1639,7 @@
56                 parsed->tz_abbr = now->tz_abbr ? strdup(now->tz_abbr) : NULL;
57         }
58         if (!parsed->tz_info) {
59 -               parsed->tz_info = now->tz_info ? timelib_tzinfo_clone(now->tz_info) : NULL;
60 +               parsed->tz_info = now->tz_info ? (!(options & TIMELIB_NO_CLONE) ? timelib_tzinfo_clone(now->tz_info) : now->tz_info) : NULL;
61         }
62         if (parsed->zone_type == 0 && now->zone_type != 0) {
63                 parsed->zone_type = now->zone_type;
64 diff -urN php-5.2.8/ext/date/lib/timelib.h php5.2-200902121330/ext/date/lib/timelib.h
65 --- php-5.2.8/ext/date/lib/timelib.h    2008-02-22 10:48:18.000000000 +0100
66 +++ php5.2-200902121330/ext/date/lib/timelib.h  2008-12-31 12:46:14.000000000 +0100
67 @@ -28,6 +28,7 @@
68  
69  #define TIMELIB_NONE             0x00
70  #define TIMELIB_OVERRIDE_TIME    0x01
71 +#define TIMELIB_NO_CLONE         0x02
72  
73  #define TIMELIB_SPECIAL_WEEKDAY  0x01
74  
75 diff -urN php-5.2.8/ext/date/lib/timelib_structs.h php5.2-200902121330/ext/date/lib/timelib_structs.h
76 --- php-5.2.8/ext/date/lib/timelib_structs.h    2007-12-31 08:20:05.000000000 +0100
77 +++ php5.2-200902121330/ext/date/lib/timelib_structs.h  2008-12-31 12:46:14.000000000 +0100
78 @@ -16,7 +16,7 @@
79  #ifndef __TIMELIB_STRUCTS_H__
80  #define __TIMELIB_STRUCTS_H__
81  
82 -#include <timelib_config.h>
83 +#include "timelib_config.h"
84  
85  #ifdef HAVE_SYS_TYPES_H
86  #include <sys/types.h>
87 diff -urN php-5.2.8/ext/date/php_date.c php5.2-200902121330/ext/date/php_date.c
88 --- php-5.2.8/ext/date/php_date.c       2008-12-02 19:01:57.000000000 +0100
89 +++ php5.2-200902121330/ext/date/php_date.c     2008-12-31 12:46:14.000000000 +0100
90 @@ -1143,7 +1143,7 @@
91         t = timelib_strtotime(times, time_len, &error, DATE_TIMEZONEDB);
92         error1 = error->error_count;
93         timelib_error_container_dtor(error);
94 -       timelib_fill_holes(t, now, 0);
95 +       timelib_fill_holes(t, now, TIMELIB_NO_CLONE);
96         timelib_update_ts(t, tzi);
97         ts = timelib_date_to_int(t, &error2);
98  
This page took 0.049005 seconds and 3 git commands to generate.