diff options
author | Ivan Nardi <12729895+IvanNardi@users.noreply.github.com> | 2023-04-25 16:37:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-25 16:37:28 +0200 |
commit | 40b6d5a2e193322e6e93b2eeb087c51d8eb6faad (patch) | |
tree | cb5a338df534f710c74107717cc9be54c07211ac /src/lib/ndpi_analyze.c | |
parent | de693cbbc91d4144b8d67a8c99c565ea21cece09 (diff) |
fuzz: extend fuzzers coverage (#1952)
Diffstat (limited to 'src/lib/ndpi_analyze.c')
-rw-r--r-- | src/lib/ndpi_analyze.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lib/ndpi_analyze.c b/src/lib/ndpi_analyze.c index 178097b9f..346e65a48 100644 --- a/src/lib/ndpi_analyze.c +++ b/src/lib/ndpi_analyze.c @@ -1096,6 +1096,7 @@ int ndpi_hw_init(struct ndpi_hw_struct *hw, if((hw->s = (double*)ndpi_calloc(hw->params.num_season_periods, sizeof(double))) == NULL) { ndpi_free(hw->y); + hw->y = NULL; return(-1); } @@ -1213,8 +1214,10 @@ void ndpi_hw_reset(struct ndpi_hw_struct *hw) { hw->num_values = 0; hw->u = hw->v = hw->sum_square_error = 0; - memset(&hw->y, 0, (hw->params.num_season_periods * sizeof(u_int64_t))); - memset(&hw->s, 0, (hw->params.num_season_periods * sizeof(double))); + if(hw->y) + memset(hw->y, 0, (hw->params.num_season_periods * sizeof(u_int64_t))); + if(hw->s) + memset(hw->s, 0, (hw->params.num_season_periods * sizeof(double))); } /* ********************************************************************************* */ |