Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bad memory allocation #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions Levenshtein.c
Original file line number Diff line number Diff line change
Expand Up @@ -4119,7 +4119,7 @@ lev_quick_median(size_t n,
double *symset;
double ml, wl;

/* first check whether the result would be an empty string
/* first check whether the result would be an empty string
* and compute resulting string length */
ml = wl = 0.0;
for (i = 0; i < n; i++) {
Expand Down Expand Up @@ -4312,7 +4312,7 @@ lev_u_quick_median(size_t n,
HQItem *symmap;
double ml, wl;

/* first check whether the result would be an empty string
/* first check whether the result would be an empty string
* and compute resulting string length */
ml = wl = 0.0;
for (i = 0; i < n; i++) {
Expand Down Expand Up @@ -6434,7 +6434,7 @@ lev_editops_matching_blocks(size_t len1,
nmb++;

/* fill the info */
mb = mblocks = (LevMatchingBlock*)malloc(nmb*sizeof(LevOpCode));
mb = mblocks = (LevMatchingBlock*)malloc(nmb*sizeof(LevMatchingBlock));
if (!mblocks) {
*nmblocks = (size_t)(-1);
return NULL;
Expand Down Expand Up @@ -6541,7 +6541,7 @@ lev_opcodes_matching_blocks(size_t len1,
}

/* convert */
mb = mblocks = (LevMatchingBlock*)malloc(nmb*sizeof(LevOpCode));
mb = mblocks = (LevMatchingBlock*)malloc(nmb*sizeof(LevMatchingBlock));
if (!mblocks) {
*nmblocks = (size_t)(-1);
return NULL;
Expand Down