Skip to content

Commit

Permalink
add nulling after free
Browse files Browse the repository at this point in the history
  • Loading branch information
kossnikita committed Nov 4, 2023
1 parent 18f3560 commit 423fc47
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion atc.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ void* atc_alloc(size_t size)
//####################################################################################################
void atc_free(void *ptr)
{
if (ptr != NULL)
#if (_ATC_RTOS == 0)
free(ptr);
#else
Expand Down Expand Up @@ -207,7 +206,10 @@ int8_t atc_command(atc_t *atc, const char *command, uint32_t timeout_ms, char *a
}
}
for (uint8_t i = 0; i < items; i++)
{
atc_free(atc->searchCmd[i]);
atc->searchCmd[i] = NULL;
}
atc_unlock(atc);
return foundIndex;
}
Expand Down

0 comments on commit 423fc47

Please sign in to comment.