fixed a problem concerning static strings and dynamic structures...
This commit is contained in:
parent
ef9e018eef
commit
8608074638
|
@ -255,7 +255,8 @@ void CmdLO_AddElement(char*** target, unsigned int* counter, char* element) {
|
||||||
*target = malloc((cnt + 1) * sizeof(char*));
|
*target = malloc((cnt + 1) * sizeof(char*));
|
||||||
if (old != 0)
|
if (old != 0)
|
||||||
memcpy(*target, old, (cnt) * sizeof(char*));
|
memcpy(*target, old, (cnt) * sizeof(char*));
|
||||||
*(*target + cnt) = element;
|
*(*target + cnt) = malloc(strlen(element) * sizeof(char));
|
||||||
|
memcpy(*(*target + cnt), element, strlen(element));
|
||||||
if (old != 0)
|
if (old != 0)
|
||||||
free(old);
|
free(old);
|
||||||
*counter = cnt + 1;
|
*counter = cnt + 1;
|
||||||
|
|
Loading…
Reference in New Issue