From 339e45b205bf5358055b6211251080308627ce5e Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 12 Mar 2017 23:20:15 -0300 Subject: [PATCH] fix uninitialized value --- lib/hooks/shift.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/hooks/shift.c b/lib/hooks/shift.c index 1db6827a4..b2ed116c6 100644 --- a/lib/hooks/shift.c +++ b/lib/hooks/shift.c @@ -67,7 +67,7 @@ static int hook_shift(struct hook *h, int when, struct hook_info *k) case HOOK_READ: for (int i = 0; i < k->cnt; i++) { - struct timespec *ts; + struct timespec *ts = NULL; switch (private->mode) { case TS_ORIGIN: ts = &k->smps[i]->ts.origin; break; @@ -75,7 +75,8 @@ static int hook_shift(struct hook *h, int when, struct hook_info *k) case TS_SENT: ts = &k->smps[i]->ts.sent; break; } - *ts = time_add(ts, &private->offset); + if (ts) + *ts = time_add(ts, &private->offset); } return k->cnt;