Check return value of pixWrite()
[experiments/leptonica.git] / leptonica-projective-transform.c
index 6035526..d89b4df 100644 (file)
@@ -97,10 +97,15 @@ int main(int argc, char *argv[])
                goto out_free_cropped_image;
        }
 
-       pixWrite("transformed_image.jpg", transformed_image, IFF_JFIF_JPEG);
+       ret = pixWrite("transformed_image.jpg", transformed_image, IFF_JFIF_JPEG);
+       if (ret != 0) {
+               ret = -EINVAL;
+               goto cleanup;
+       }
 
        ret = 0;
 
+cleanup:
        pixDestroy(&transformed_image);
 out_free_cropped_image:
        pixDestroy(&cropped_image);