tbm_surface_internal: set up error handling when dump png 59/219959/1
authorChangyeon Lee <cyeon.lee@samsung.com>
Thu, 12 Dec 2019 04:33:07 +0000 (13:33 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Thu, 12 Dec 2019 04:59:14 +0000 (13:59 +0900)
Change-Id: I0ab6cb454021576e1f1308dad5dc67b08a49ecad

src/tbm_surface_internal.c

index 659b19e..51c05a7 100644 (file)
@@ -1797,6 +1797,14 @@ _tbm_surface_internal_dump_file_png(const char *file, const void *data, int widt
                return;
        }
 
+       if (setjmp(png_jmpbuf(pPngStruct))) {
+               /* if png has problem of writing the file, we get here */
+               TBM_ERR("fail to write png file.\n");
+               png_destroy_write_struct(&pPngStruct, &pPngInfo);
+               fclose(fp);
+               return;
+       }
+
        png_init_io(pPngStruct, fp);
        if (format == TBM_FORMAT_XRGB8888) {
                pixel_size = 3;