diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-03-20 16:13:00 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-03-20 16:13:00 +0100 |
commit | 1be429561723dc20ff7f4f1739eb0580cf70564b (patch) | |
tree | 36577a308ee252832c448423cd69006ac15bde8b /sql/item_timefunc.cc | |
parent | 8f607aae127439e132dae00b2750727162f4d564 (diff) | |
download | mariadb-git-1be429561723dc20ff7f4f1739eb0580cf70564b.tar.gz |
MDEV-4293 Valgrind warnings (Conditional jump or move depends on uninitialised value) in remove_eq_conds on time functions with NULL argument
val_int() is expected to return 0 for NULL's
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r-- | sql/item_timefunc.cc | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 9f2f9b2950d..a3b7611ba69 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -856,16 +856,14 @@ longlong Item_func_dayofmonth::val_int() { DBUG_ASSERT(fixed == 1); MYSQL_TIME ltime; - (void) get_arg0_date(<ime, TIME_FUZZY_DATE); - return (longlong) ltime.day; + return get_arg0_date(<ime, TIME_FUZZY_DATE) ? 0 : (longlong) ltime.day; } longlong Item_func_month::val_int() { DBUG_ASSERT(fixed == 1); MYSQL_TIME ltime; - (void) get_arg0_date(<ime, TIME_FUZZY_DATE); - return (longlong) ltime.month; + return get_arg0_date(<ime, TIME_FUZZY_DATE) ? 0 : (longlong) ltime.month; } @@ -919,16 +917,14 @@ longlong Item_func_hour::val_int() { DBUG_ASSERT(fixed == 1); MYSQL_TIME ltime; - (void) get_arg0_time(<ime); - return ltime.hour; + return get_arg0_time(<ime) ? 0 : ltime.hour; } longlong Item_func_minute::val_int() { DBUG_ASSERT(fixed == 1); MYSQL_TIME ltime; - (void) get_arg0_time(<ime); - return ltime.minute; + return get_arg0_time(<ime) ? 0 : ltime.minute; } /** @@ -938,8 +934,7 @@ longlong Item_func_second::val_int() { DBUG_ASSERT(fixed == 1); MYSQL_TIME ltime; - (void) get_arg0_time(<ime); - return ltime.second; + return get_arg0_time(<ime) ? 0 : ltime.second; } @@ -1056,8 +1051,7 @@ longlong Item_func_year::val_int() { DBUG_ASSERT(fixed == 1); MYSQL_TIME ltime; - (void) get_arg0_date(<ime, TIME_FUZZY_DATE); - return (longlong) ltime.year; + return get_arg0_date(<ime, TIME_FUZZY_DATE) ? 0 : (longlong) ltime.year; } |