Skip to content

Commit 0b522b4

Browse files
Add NULL check in calldata_cleanup
1 parent 955058d commit 0b522b4

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src_features/generic_tx_parser/calldata.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,12 @@ bool calldata_append(const uint8_t *buffer, size_t size) {
171171
}
172172

173173
void calldata_cleanup(void) {
174-
mem_dealloc(g_calldata->chunks_size);
175-
mem_dealloc(sizeof(*g_calldata));
176-
g_calldata = NULL;
177-
mem_dealloc(g_calldata_alignment);
174+
if (g_calldata != NULL) {
175+
mem_dealloc(g_calldata->chunks_size);
176+
mem_dealloc(sizeof(*g_calldata));
177+
g_calldata = NULL;
178+
mem_dealloc(g_calldata_alignment);
179+
}
178180
}
179181

180182
static bool has_valid_calldata(const s_calldata *calldata) {

0 commit comments

Comments
 (0)