decoder->mImageFrame->Init(0, 0, width, height, format);
if (!decoder->mImageFrame) return MNG_FALSE;  if (NS_FAILED(decoder->mImageFrame->Init(0, 0, width, height, format))) return MNG_FALSE;
il_mng_processheader(mng_handle handle, mng_uint32 width, mng_uint32 height){  EXTRACT_CONTAINER;  gfx_format format;#if defined(XP_PC) || defined(XP_BEOS) || defined(MOZ_WIDGET_PHOTON)  if (mng_get_alphadepth(handle)) {    format = gfxIFormats::BGR_A8;    mng_set_canvasstyle(handle, MNG_CANVAS_RGB8_A8);  } else {    format = gfxIFormats::BGR;    mng_set_canvasstyle(handle, MNG_CANVAS_RGB8);  }#else  if (mng_get_alphadepth(handle)) {    format = gfxIFormats::RGB_A8;    mng_set_canvasstyle(handle, MNG_CANVAS_RGB8_A8);  } else {    format = gfxIFormats::RGB;    mng_set_canvasstyle(handle, MNG_CANVAS_RGB8);  }#endif  nsMNGDecoder* decoder = container->mDecoder;  if (decoder->mObserver)    decoder->mObserver->OnStartDecode(nsnull, nsnull);  if(decoder->mImageContainer)    decoder->mImageContainer->Init(width,                                    height,                                   decoder->mObserver);  if (decoder->mObserver)    decoder->mObserver->OnStartContainer(nsnull,                                          nsnull,                                          decoder->mImageContainer);  // initalize the frame and append it to the container  decoder->mImageFrame = do_CreateInstance("@mozilla.org/gfx/image/frame;2");  decoder->mImageFrame->Init(0, 0, width, height, format);    decoder->mImageContainer->AppendFrame(decoder->mImageFrame);      if (decoder->mObserver)    decoder->mObserver->OnStartFrame(nsnull, nsnull, decoder->mImageFrame);  container->mFrame->GetImageBytesPerRow(&container->mByteWidth);  container->mFrame->GetAlphaBytesPerRow(&container->mByteWidthAlpha);  if ((format!=gfxIFormats::RGB) && (format!=gfxIFormats::BGR)) {    container->alpha =       (unsigned char*)nsMemory::Alloc(container->mByteWidthAlpha*height);    memset(container->alpha, 0, container->mByteWidthAlpha*height);  } else    container->alpha = 0;  container->image =     (unsigned char*)nsMemory::Alloc(container->mByteWidth*height);  memset(container->image, 0, container->mByteWidth*height);  return MNG_TRUE;}