]> git.ipfire.org Git - thirdparty/cups-filters.git/commitdiff
libcupsfilters: in pdftoraster() free options list in parseOpts()
authorTill Kamppeter <till.kamppeter@gmail.com>
Thu, 24 Mar 2022 23:50:19 +0000 (00:50 +0100)
committerTill Kamppeter <till.kamppeter@gmail.com>
Thu, 24 Mar 2022 23:50:19 +0000 (00:50 +0100)
Also removed conditionals for CUPS < 1.7.

cupsfilters/pdftoraster.cxx

index e3040cdac53d786095c104faa7876856379a9f39..1c60aa99bf4c03bde9122e69303c422f6b08dbb9 100644 (file)
@@ -323,7 +323,6 @@ static int parseOpts(filter_data_t *data,
      change in the future when we add Apple Raster output support to
      this filter. */
 
-#ifdef HAVE_CUPS_1_7
   if (parameters) {
     outformat = *(filter_out_format_t *)parameters;
     if (outformat != OUTPUT_FORMAT_CUPS_RASTER &&
@@ -341,7 +340,6 @@ static int parseOpts(filter_data_t *data,
 
   if (outformat == OUTPUT_FORMAT_PWG_RASTER)
     doc->pwgraster = 1;
-#endif /* HAVE_CUPS_1_7 */
 
   num_options = joinJobOptionsAndAttrs(data, num_options, &options);
 
@@ -440,15 +438,12 @@ static int parseOpts(filter_data_t *data,
       free(profile);
     }
 
-#ifdef HAVE_CUPS_1_7
     if ((attr = ppdFindAttr(doc->ppd,"PWGRaster",0)) != 0 &&
        (!strcasecmp(attr->value, "true")
         || !strcasecmp(attr->value, "on") ||
         !strcasecmp(attr->value, "yes")))
       doc->pwgraster = 1;
-#endif /* HAVE_CUPS_1_7 */
   } else {
-#ifdef HAVE_CUPS_1_7
     doc->pwgraster = 1;
     t = cupsGetOption("media-class", num_options, options);
     if (t == NULL)
@@ -521,12 +516,6 @@ static int parseOpts(filter_data_t *data,
       doc->colour_profile.colorProfile = cmsOpenProfileFromFile(profile,"r");
       free(profile);
     }
-
-#else
-    if (log) log(ld, FILTER_LOGLEVEL_ERROR,
-                "pdftoraster: No PPD file specified.");
-    return (1);
-#endif /* HAVE_CUPS_1_7 */
   }
   if ((val = cupsGetOption("print-color-mode", num_options, options)) != NULL
                            && !strncasecmp(val, "bi-level", 8))
@@ -534,6 +523,9 @@ static int parseOpts(filter_data_t *data,
   if (log) log(ld, FILTER_LOGLEVEL_DEBUG,
     "pdftoraster: Page size requested: %s", doc->header.cupsPageSizeName);
 
+  if (num_options)
+    cupsFreeOptions(num_options, options);
+
   return (0);
 }