blob: 3d0ac25308e1ff7d3240e4e5db270c1ac3767320 [file] [log] [blame]
This patch fixes a bug in the original driver: write to NULL descriptor.
b/182179434
--- a/src/wrapper.c
+++ b/src/wrapper.c
@@ -244,6 +244,10 @@ main (int argc, char *argv[])
break;
}
+ if(pfp == NULL){ // do not write anything if pipe is not open
+ break;
+ }
+
if(first_fwrite){//最初のfwriteだけ、ページ数を送信
fwrite (&pageNum, 1, 1, pfp);
first_fwrite = FALSE;
@@ -404,7 +408,9 @@ main (int argc, char *argv[])
free (page_raw);
free (page_raw_cache);
- pclose (pfp);
+ if(pfp != NULL){
+ pclose (pfp);
+ }
cupsRasterClose (ras);
return 0;