]> granicus.if.org Git - php/commitdiff
fix several leaks in date_sun*() functions
authorAntony Dovgal <tony2001@php.net>
Sat, 18 Mar 2006 23:43:48 +0000 (23:43 +0000)
committerAntony Dovgal <tony2001@php.net>
Sat, 18 Mar 2006 23:43:48 +0000 (23:43 +0000)
ext/date/lib/parse_tz.c
ext/date/php_date.c

index 737181da5c4345e5f2c2206e5e4b957329fbf0de..aa8aebd46b30c0842593c645316b1a41b3b3fed6 100644 (file)
@@ -368,6 +368,7 @@ timelib_time_offset *timelib_get_time_zone_info(timelib_sll ts, timelib_tzinfo *
 timelib_sll timelib_get_current_offset(timelib_time *t)
 {
        timelib_time_offset *gmt_offset;
+       timelib_sll retval;
                        
        switch (t->zone_type) {
                case TIMELIB_ZONETYPE_ABBR:
@@ -376,7 +377,9 @@ timelib_sll timelib_get_current_offset(timelib_time *t)
                        
                case TIMELIB_ZONETYPE_ID:
                        gmt_offset = timelib_get_time_zone_info(t->sse, t->tz_info);
-                       return gmt_offset->offset;
+                       retval = gmt_offset->offset;
+                       timelib_time_offset_dtor(gmt_offset);
+                       return retval;
 
                default:
                        return 0;
index 758c0191063e8a1a0cbf440c9fb53e986d4d48ab..5c5dd59218980c461418dab7e6d17747a31955dd 100644 (file)
@@ -1746,7 +1746,8 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su
 
        timelib_unixtime2local(t, time);
        rs = timelib_astro_rise_set_altitude(t, longitude, latitude, altitude, altitude > -1 ? 1 : 0, &h_rise, &h_set, &rise, &set, &transit);
-
+       timelib_time_dtor(t);
+       
        if (rs != 0) {
                RETURN_FALSE;
        }
@@ -1889,6 +1890,8 @@ PHP_FUNCTION(date_sun_info)
                        t2->sse = set;
                        add_assoc_long(return_value, "astronomical_twilight_end", timelib_date_to_int(t2, &dummy));
        }
+       timelib_time_dtor(t);
+       timelib_time_dtor(t2);
 }
 /* }}} */
 /*