I have the following line in my main() function (which uses EasyBMP):
RGBApixel * myPixel = myFavoriteColor(192);
which is defined as:
RGBApixel * myFavoriteColor(int intensity)
{
RGBApixel color;
color.Red = 0;
color.Green = intensity/2;
color.Blue = intensity;
return &color;
}
and I'm getting the following error on a line that says "delete myPixel": malloc: * error for object 0x7fff5fbff9d0: pointer being freed was not allocated * set a breakpoint in malloc_error_break to debug
Why is it not getting allocated correctly?