Yes it does. When you are deleting
You are releasing the memory allocated for data. However the memory allocated
data[i] = new char[numOfChars];
is still not freed.
You have to iterate over
data and delete each
data[i] before deleting data.
Generally you should make sure you have as many
Here you have
numOfStrings + 1
news and only one
One more leak
Since you are doing
int index = 1, boundary = 5, sizeToMove = (boundary - index) * sizeof(numOfChars); memmove(&data[index + 1],&data[index],sizeToMove);
(You are not moving shifting five places as you thought but 4 places
(5 - 1 = 4))
After this operation
data will get the value of data data <- data data <- data data <- data data <- data
And what was pointed to by
data will be lost.
data, data will have the same value (point to the same place)
This can also explain why you are getting segfault when you want to delete by iterating over