uint8_t* baseAddress = CVPixelBufferGetBaseAddress(imageBuffer); void* free_me = 0; if (true) { // iOS bug? uint8_t* tmp = baseAddress; int bytes = bytesPerRow*height; free_me = baseAddress = (uint8_t*)malloc(bytes); baseAddress[0] = 0xdb; memcpy(baseAddress,tmp,bytes); } free(free_me);