Skip to content

Commit 4b58b1c

Browse files
committed
add back setting ptrs to null after freeingmake
1 parent 4e25da7 commit 4b58b1c

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/affine/index.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ static void free_type_data(expr *node)
155155
{
156156
index_expr *idx = (index_expr *) node;
157157
free(idx->indices);
158+
idx->indices = NULL;
158159
}
159160

160161
expr *new_index(expr *child, int d1, int d2, const int *indices, int n_idxs)

src/affine/linear_op.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,13 @@ static void free_type_data(expr *node)
5555
if (!node->jacobian)
5656
{
5757
free_csr_matrix(lin_node->A_csr);
58+
lin_node->A_csr = NULL;
5859
}
5960

6061
free_csc_matrix(lin_node->A_csc);
61-
62-
if (lin_node->b != NULL)
63-
{
64-
free(lin_node->b);
65-
}
62+
lin_node->A_csc = NULL;
63+
free(lin_node->b);
64+
lin_node->b = NULL;
6665
}
6766

6867
static void jacobian_init(expr *node)

0 commit comments

Comments
 (0)