summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/imagedev
diff options
context:
space:
mode:
author arbee <rb6502@users.noreply.github.com>2019-08-10 07:52:31 -0400
committer arbee <rb6502@users.noreply.github.com>2019-08-10 07:52:31 -0400
commit909bfe98904ffb47c020d054faf9cfcaf9ad57b5 (patch)
treeabb2e298c87825c197cf1b0d01d80c6b1a0f6810 /src/devices/imagedev
parent65bcb3be2b6235f49049719243bbd37e07114f59 (diff)
picture_image_device: clean up properly if the PNG load fails (nw)
Diffstat (limited to 'src/devices/imagedev')
-rw-r--r--src/devices/imagedev/picture.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/devices/imagedev/picture.cpp b/src/devices/imagedev/picture.cpp
index 87524aa7457..f80bfb2885e 100644
--- a/src/devices/imagedev/picture.cpp
+++ b/src/devices/imagedev/picture.cpp
@@ -20,7 +20,7 @@
DEFINE_DEVICE_TYPE(IMAGE_PICTURE, picture_image_device, "picture_image", "Still Image")
//-------------------------------------------------
-// microdrive_image_device - constructor
+// picture_image_device - constructor
//-------------------------------------------------
picture_image_device::picture_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
@@ -31,7 +31,7 @@ picture_image_device::picture_image_device(const machine_config &mconfig, const
}
//-------------------------------------------------
-// microdrive_image_device - destructor
+// picture_image_device - destructor
//-------------------------------------------------
picture_image_device::~picture_image_device()
@@ -53,6 +53,10 @@ image_init_result picture_image_device::call_load()
m_picture = new bitmap_argb32;
if (png_read_bitmap(image_core_file(), *m_picture) != PNGERR_NONE)
{
+ delete m_picture;
+ m_picture = nullptr;
+
+ // todo: try JPEG here.
return image_init_result::FAIL;
}