My code is:
int args_size = 5; char ** args; args = (char **) malloc (sizeof (char *) * args_size); // ... args = (char **) realloc (args, sizeof (char *) * (args_size + = 5));
I want to increase the size by 5.
But I get this error:
*** glibc detected *** ./a.out: realloc (): invalid next size: 0x0000000000a971c0 ***
I know the catching realloc temporary variable is good, but just for simplicity ...
solvable
Initially, the size argsis 5 elements. When the program was filling args, the 6th element was mistakenly added to it, and then it was called realloc.
args
realloc
This caused the error mentioned in the question.
, WhozCraig, Jens Gustedt ...
!