Skip to content

Commit

Permalink
cube/char_bigrams: Fix some memory leaks
Browse files Browse the repository at this point in the history
Coverity report:

CID 1164717 (#1 of 1): Resource leak (RESOURCE_LEAK)
10. leaked_storage: Variable upper_32 going out of scope leaks
 the storage it points to.

CID 1164718 (#1 of 1): Resource leak (RESOURCE_LEAK)
10. leaked_storage: Variable lower_32 going out of scope leaks
 the storage it points to.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed Nov 28, 2016
1 parent d2389a8 commit 614f44a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cube/char_bigrams.cpp
Expand Up @@ -179,14 +179,14 @@ int CharBigrams::Cost(const char_32 *char_32_ptr, CharSet *char_set) const {
if (lower_32 && lower_32[0] != 0) {
int cost_lower = MeanCostWithSpaces(lower_32);
cost = MIN(cost, cost_lower);
delete [] lower_32;
}
delete [] lower_32;
char_32 *upper_32 = CubeUtils::ToUpper(char_32_ptr, char_set);
if (upper_32 && upper_32[0] != 0) {
int cost_upper = MeanCostWithSpaces(upper_32);
cost = MIN(cost, cost_upper);
delete [] upper_32;
}
delete [] upper_32;
}
return cost;
}
Expand Down

0 comments on commit 614f44a

Please sign in to comment.