Code:
char* get(char buffer[],int from, int until, int len)
{
int a = from;
int b = 0;
int end = from+until;
char *lol;
lol = new char[until+1];
while (a < len && a <= end) {
lol[b] = buffer[a];
a++;
b++;
}
lol[b] = '\0';
return lol;
}
That, as you can see, is causing a memory leak since i am using new.
The problem is i have no idea where to use delete.