Commit af871b3f authored by Arnaud Blanchard's avatar Arnaud Blanchard
Browse files

Allocate(0) id a free with blc_mem

parent 5b38088b
......@@ -38,10 +38,12 @@ void blc_mem::allocate(){
}
void blc_mem::allocate(size_t new_size){
if (new_size != size || data == NULL) // Changement de taille ou l'allocation n'a encore jamais été faite
{
free(data);
data = MANY_ALLOCATIONS(new_size, char);
if (data) free(data);
if (new_size) data = MANY_ALLOCATIONS(new_size, char);
else data=NULL;
size = new_size;
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment