Skip to content

Commit

Permalink
fraud_detection: Properly initialize self-built tmrec_t structs
Browse files Browse the repository at this point in the history
Credits to Adrian Fretwell for reporting this issue!

Fixes #2712
  • Loading branch information
liviuchircu committed Dec 20, 2021
1 parent 5ddad41 commit c972fe1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions modules/fraud_detection/frd_load.c
Expand Up @@ -247,6 +247,7 @@ static int create_time_rec(const str *time_start, const str *time_end,
memset(trx, 0, sizeof *trx);
trx->is_leaf = 1;

tmrec_init(trec);
trec->duration = (end_h * 3600 + end_m * 60) -
(trec->ts.tm_hour * 3600 + trec->ts.tm_min * 60);
trec->ts.tm_isdst = -1 /*daylight*/;
Expand Down
2 changes: 1 addition & 1 deletion time_rec.c
Expand Up @@ -485,7 +485,7 @@ int tr_byxxx_free(tr_byxxx_p _bxp)
return 0;
}

static inline void tmrec_init(tmrec_p t)
void tmrec_init(tmrec_p t)
{
memset(t, 0, sizeof *t);

Expand Down
1 change: 1 addition & 0 deletions time_rec.h
Expand Up @@ -185,6 +185,7 @@ typedef struct _tmrec_expr
} tmrec_expr_t;

tmrec_p tmrec_new(char);
void tmrec_init(tmrec_p t);

int tr_parse_tz(tmrec_p, char*);
int tr_parse_dtstart(tmrec_p, char*);
Expand Down

0 comments on commit c972fe1

Please sign in to comment.