Le realloc peut convenir dans ton cas;
il s'agit de ré-allouer une variable auparavant allouées par un malloc :
Trouvé sur msdn :
Reallocate memory blocks.
void*realloc( void*memblock, size_tsize);
Parameters
- memblock
- Pointer to previously allocated memory block.
- size
New size in bytes.
Return Value
realloc returns a void pointer to the reallocated (and possibly moved) memory block. The return value is NULL if the size is zero and the buffer argument is not NULL, or if there is not enough available memory to expand the block to the given size. In the first case, the original block is freed. In the second, the original block is unchanged. The return value points to a storage space that is guaranteed to be suitably aligned for storage of any type of object. To get a pointer to a type other than void, use a type cast on the return value.