Skip to content

Commit 88277c5

Browse files
Solves two memory leaks in the examples
1 parent d8f668c commit 88277c5

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

LAPACKE/example/example_DGESV_colmajor.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ int main(int argc, char **argv) {
103103
print_matrix_colmajor( "Details of LU factorization", n, n, A, lda );
104104
/* Print pivot indices */
105105
print_vector( "Pivot indices", n, ipiv );
106+
107+
/* Free matrices and vectors */
108+
free(A);
109+
free(b);
110+
free(ipiv);
111+
106112
exit( 0 );
107113
} /* End of LAPACKE_dgesv Example */
108114

LAPACKE/example/example_DGESV_rowmajor.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ int main(int argc, char **argv) {
100100
print_matrix_rowmajor( "Details of LU factorization", n, n, A, lda );
101101
/* Print pivot indices */
102102
print_vector( "Pivot indices", n, ipiv );
103+
104+
/* Free matrices and vectors */
105+
free(A);
106+
free(b);
107+
free(ipiv);
108+
103109
exit( 0 );
104110
} /* End of LAPACKE_dgesv Example */
105111

0 commit comments

Comments
 (0)