Skip to content

Commit

Permalink
Don't need to guard against free(NULL), pickup code tweak in PDFio.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Feb 22, 2025
1 parent 99fc84b commit 208f920
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 28 deletions.
8 changes: 3 additions & 5 deletions cups/encode.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// Option encoding routines for CUPS.
//
// Copyright © 2021-2024 by OpenPrinting.
// Copyright © 2021-2025 by OpenPrinting.
// Copyright © 2007-2019 by Apple Inc.
// Copyright © 1997-2007 by Easy Software Products.
//
Expand Down Expand Up @@ -503,8 +503,7 @@ _cupsEncodeOption(
{
cupsFreeOptions(num_cols, cols);

if (copy)
free(copy);
free(copy);

ippDeleteAttribute(ipp, attr);
return (NULL);
Expand All @@ -521,8 +520,7 @@ _cupsEncodeOption(
}
}

if (copy)
free(copy);
free(copy);

return (attr);
}
Expand Down
6 changes: 2 additions & 4 deletions cups/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// our own file functions allows us to provide transparent support of
// different line endings, gzip'd print files, etc.
//
// Copyright © 2021-2024 by OpenPrinting.
// Copyright © 2021-2025 by OpenPrinting.
// Copyright © 2007-2019 by Apple Inc.
// Copyright © 1997-2007 by Easy Software Products, all rights reserved.
//
Expand Down Expand Up @@ -141,9 +141,7 @@ cupsFileClose(cups_file_t *fp) // I - CUPS file
fd = fp->fd;
mode = fp->mode;

if (fp->printf_buffer)
free(fp->printf_buffer);

free(fp->printf_buffer);
free(fp);

// Close the file, returning the close status...
Expand Down
2 changes: 1 addition & 1 deletion pdfio
Submodule pdfio updated 1 files
+0 −3 pdfio-content.c
27 changes: 9 additions & 18 deletions tools/ippeveprinter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1986,8 +1986,7 @@ delete_job(ippeve_job_t *job) // I - Job

ippDelete(job->attrs);

if (job->message)
free(job->message);
free(job->message);

if (job->filename)
{
Expand Down Expand Up @@ -2018,22 +2017,14 @@ delete_printer(

cupsDNSSDDelete(printer->dnssd);

if (printer->dnssd_name)
free(printer->dnssd_name);
if (printer->name)
free(printer->name);
if (printer->icons[0])
free(printer->icons[0]);
if (printer->strings)
free(printer->strings);
if (printer->command)
free(printer->command);
if (printer->device_uri)
free(printer->device_uri);
if (printer->directory)
free(printer->directory);
if (printer->hostname)
free(printer->hostname);
free(printer->dnssd_name);
free(printer->name);
free(printer->icons[0]);
free(printer->strings);
free(printer->command);
free(printer->device_uri);
free(printer->directory);
free(printer->hostname);

ippDelete(printer->attrs);
cupsArrayDelete(printer->jobs);
Expand Down

0 comments on commit 208f920

Please sign in to comment.