mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 13:23:51 -07:00
fix memleak
This commit is contained in:
parent
f5b7371d7c
commit
2044fd4130
1 changed files with 3 additions and 1 deletions
|
@ -66,8 +66,10 @@ static RetType write_to_buffer(void *cookie, const char *data, LenType len) {
|
||||||
// make room
|
// make room
|
||||||
size_t newalloc = newsize + newsize / 2 + 1; // give 50% more room
|
size_t newalloc = newsize + newsize / 2 + 1; // give 50% more room
|
||||||
ptr = realloc(ptr, newalloc);
|
ptr = realloc(ptr, newalloc);
|
||||||
if (ptr == NULL)
|
if (ptr == NULL) {
|
||||||
|
free(ptr);
|
||||||
return -1;
|
return -1;
|
||||||
|
)
|
||||||
b->alloc = newalloc;
|
b->alloc = newalloc;
|
||||||
*b->ptr = ptr;
|
*b->ptr = ptr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue