diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2008-01-24 22:22:46 +0000 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2008-01-24 22:22:46 +0000 |
commit | 613cc5583465b2fa35288a2f28d0e408904c4fd9 (patch) | |
tree | 174bf1a006e28d3c7c977896205fa501c7d93234 | |
parent | a882d6c1eec55fb9a00ce61acd6d776884d0c84a (diff) |
Fixed two valgrind warnings (partially uninitialized "struct tm" vars.)
-rw-r--r-- | lib/misc.c | 2 | ||||
-rw-r--r-- | protocols/oscar/oscar.c | 1 |
2 files changed, 3 insertions, 0 deletions
@@ -89,12 +89,14 @@ time_t get_time(int year, int month, int day, int hour, int min, int sec) { struct tm tm; + memset(&tm, 0, sizeof(struct tm)); tm.tm_year = year - 1900; tm.tm_mon = month - 1; tm.tm_mday = day; tm.tm_hour = hour; tm.tm_min = min; tm.tm_sec = sec >= 0 ? sec : time(NULL) % 60; + return mktime(&tm); } diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index c96e342e..30ad4b68 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -2272,6 +2272,7 @@ static int gaim_icqinfo(aim_session_t *sess, aim_frame_t *fr, ...) if (info->birthyear || info->birthmonth || info->birthday) { char date[30]; struct tm tm; + memset(&tm, 0, sizeof(struct tm)); tm.tm_mday = (int)info->birthday; tm.tm_mon = (int)info->birthmonth-1; tm.tm_year = (int)info->birthyear%100; |