Check return value of pixWrite() master
authorAntonio Ospite <ospite@studenti.unina.it>
Sat, 14 Sep 2013 15:28:13 +0000 (17:28 +0200)
committerAntonio Ospite <ospite@studenti.unina.it>
Sat, 14 Sep 2013 15:28:13 +0000 (17:28 +0200)
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);