Fix NULL dereference issue and uninitialized variable issue
[platform/core/connectivity/bluetooth-agent.git] / map-agent / bluetooth_map_agent.c
index 5f59b9f..df0a86f 100644 (file)
@@ -602,6 +602,9 @@ time_t _get_time_t_from_timestamp(char *timestamp)
        ymd = strtol(timestamp, &ptr, 10);
        hms = strtol(ptr + 1, &ptr2, 10);
 
+       /* Initialize local_time */
+       memset(&local_time, 0, sizeof(struct tm));
+
        /* parse year, month, day */
        local_time.tm_mday = ymd % 100;
        ymd = (ymd - local_time.tm_mday) / 100;