Skip to content

Commit 254824d

Browse files
BUG: Fix for memory leak, issue/39
When mirroring harmonics past Nyquist frequency an array half_shape was allocated but never freed.
1 parent 54b3271 commit 254824d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mkl_fft/src/mklfft.c.src

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,7 @@ int @REALIN@_@COMPLEXOUT@_mkl_@mode@_out(
807807
half_shape[axis] = (n_last > 2) ? n_last - nh_last: 0;
808808

809809
multi_iter_new(&mit, half_shape, xout_rank);
810+
mkl_free(half_shape);
810811

811812
while(!MultiIter_Done(mit)) {
812813
char *tmp1, *tmp2;
@@ -846,7 +847,6 @@ int @REALIN@_@COMPLEXOUT@_mkl_@mode@_out(
846847

847848

848849
multi_iter_free(&mit);
849-
mkl_free(half_shape);
850850
}
851851
}
852852

@@ -1888,6 +1888,7 @@ int
18881888
half_shape[last_idx] = (n_last > 2) ? n_last - nh_last: 0;
18891889

18901890
multi_iter_new(&mit, half_shape, xout_rank);
1891+
mkl_free(half_shape);
18911892

18921893
while(!MultiIter_Done(mit)) {
18931894
char *tmp1, *tmp2;

0 commit comments

Comments
 (0)