Skip to content

Commit 810a79f

Browse files
authored
Merge pull request #7 from kossnikita/fix/null-free
Fix null after free
2 parents 18f3560 + 423fc47 commit 810a79f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

atc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ void* atc_alloc(size_t size)
2020
//####################################################################################################
2121
void atc_free(void *ptr)
2222
{
23-
if (ptr != NULL)
2423
#if (_ATC_RTOS == 0)
2524
free(ptr);
2625
#else
@@ -207,7 +206,10 @@ int8_t atc_command(atc_t *atc, const char *command, uint32_t timeout_ms, char *a
207206
}
208207
}
209208
for (uint8_t i = 0; i < items; i++)
209+
{
210210
atc_free(atc->searchCmd[i]);
211+
atc->searchCmd[i] = NULL;
212+
}
211213
atc_unlock(atc);
212214
return foundIndex;
213215
}

0 commit comments

Comments
 (0)