8000 FIX Fix memory leak in liblinear helper csr_to_sparse error path (#14… · rth/scikit-learn@8632775 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8632775

Browse files
alexhenriejnothman
authored andcommitted
FIX Fix memory leak in liblinear helper csr_to_sparse error path (scikit-learn#14118)
1 parent 0c11070 commit 8632775

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sklearn/svm/src/liblinear/liblinear_helper.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ static struct feature_node **csr_to_sparse(double *values,
8787

8888
sparse[i] = malloc ((n+have_bias+1) * sizeof(struct feature_node));
8989
if (sparse[i] == NULL) {
90-
int l;
91-
for (l=0; l<i; l++)
92-
free(sparse[l]);
93-
break;
90+
for (j=0; j<i; ++j)
91+
free(sparse[j]);
92+
free(sparse);
93+
return NULL;
9494
}
9595

9696
temp = sparse[i];

0 commit comments

Comments
 (0)
0