utils: initialize timespec structure

Coverity:
Defect type: UNINIT
src/NetworkManagerUtils.c:1906: uninit_use_in_call: Using uninitialized value "tp.tv_nsec" when calling "monotonic_timestamp_get".
src/NetworkManagerUtils.c:1879: uninit_use_in_call: Using uninitialized value "tp.tv_nsec" when calling "monotonic_timestamp_get".
src/NetworkManagerUtils.c:1852: uninit_use_in_call: Using uninitialized value "tp.tv_nsec" when calling "monotonic_timestamp_get".
src/NetworkManagerUtils.c:1825: uninit_use_in_call: Using uninitialized value "tp.tv_nsec" when calling "monotonic_timestamp_get".
This commit is contained in:
Jiří Klimeš 2014-12-04 16:57:06 +01:00
parent d80bb52872
commit 7744bd0f85

View file

@ -1862,7 +1862,7 @@ monotonic_timestamp_get (struct timespec *tp)
gint64
nm_utils_get_monotonic_timestamp_ns (void)
{
struct timespec tp;
struct timespec tp = { 0 };
monotonic_timestamp_get (&tp);
@ -1889,7 +1889,7 @@ nm_utils_get_monotonic_timestamp_ns (void)
gint64
nm_utils_get_monotonic_timestamp_us (void)
{
struct timespec tp;
struct timespec tp = { 0 };
monotonic_timestamp_get (&tp);
@ -1916,7 +1916,7 @@ nm_utils_get_monotonic_timestamp_us (void)
gint64
nm_utils_get_monotonic_timestamp_ms (void)
{
struct timespec tp;
struct timespec tp = { 0 };
monotonic_timestamp_get (&tp);
@ -1943,7 +1943,7 @@ nm_utils_get_monotonic_timestamp_ms (void)
gint32
nm_utils_get_monotonic_timestamp_s (void)
{
struct timespec tp;
struct timespec tp = { 0 };
monotonic_timestamp_get (&tp);
return (((gint64) tp.tv_sec) + monotonic_timestamp_offset_sec);