diff options
author | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2013-11-08 15:18:01 +0000 |
---|---|---|
committer | msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2013-11-08 15:18:01 +0000 |
commit | dd0eea8e717362867a8d150c5d046db1274f1414 (patch) | |
tree | 6db0ff22d830c3d71e4cb46c75be41b3f7a48a31 | |
parent | 0c229544f4582576be0ccb3ca9103c183c4eb1f1 (diff) | |
download | cups-dd0eea8e717362867a8d150c5d046db1274f1414.tar.gz |
Mirror fix from trunk.
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/branches/branch-1.7@11418 a1ca3aef-8c08-0410-bb20-df032aa958be
-rw-r--r-- | scheduler/job.c | 31 | ||||
-rw-r--r-- | scheduler/printers.c | 2 |
2 files changed, 19 insertions, 14 deletions
diff --git a/scheduler/job.c b/scheduler/job.c index da5bb29e9..cb56f42d2 100644 --- a/scheduler/job.c +++ b/scheduler/job.c @@ -486,6 +486,7 @@ cupsdContinueJob(cupsd_job_t *job) /* I - Job */ /* Pipes used between filters */ int envc; /* Number of environment variables */ struct stat fileinfo; /* Job file information */ + int argc; /* Number of arguments */ char **argv = NULL, /* Filter command-line arguments */ filename[1024], /* Job filename */ command[1024], /* Full path to command */ @@ -836,11 +837,11 @@ cupsdContinueJob(cupsd_job_t *job) /* I - Job */ */ if (job->printer->remote) - argv = calloc(7 + job->num_files, sizeof(char *)); + argc = 6 + job->num_files; else - argv = calloc(8, sizeof(char *)); + argc = 7; - if (!argv) + if ((argv = calloc(argc + 1, sizeof(char *))) == NULL) { cupsdLogMessage(CUPSD_LOG_DEBUG, "Unable to allocate argument array - %s", strerror(errno)); @@ -1172,8 +1173,13 @@ cupsdContinueJob(cupsd_job_t *job) /* I - Job */ cupsdLogJob(job, CUPSD_LOG_INFO, "Started filter %s (PID %d)", command, pid); - argv[6] = NULL; - slot = !slot; + if (argv[6]) + { + free(argv[6]); + argv[6] = NULL; + } + + slot = !slot; } cupsArrayDelete(filters); @@ -1257,8 +1263,9 @@ cupsdContinueJob(cupsd_job_t *job) /* I - Job */ cupsdClosePipe(filterfds[slot]); - for (i = 0; i < job->num_files; i ++) - free(argv[i + 6]); + for (i = 6; i < argc; i ++) + if (argv[i]) + free(argv[i]); free(argv); @@ -1291,13 +1298,9 @@ cupsdContinueJob(cupsd_job_t *job) /* I - Job */ if (argv) { - if (job->printer->remote && job->num_files > 1) - { - for (i = 0; i < job->num_files; i ++) - free(argv[i + 6]); - } - - free(argv); + for (i = 6; i < argc; i ++) + if (argv[i]) + free(argv[i]); } if (printer_state_reasons) diff --git a/scheduler/printers.c b/scheduler/printers.c index ecf2ce1d4..7a5ee0c56 100644 --- a/scheduler/printers.c +++ b/scheduler/printers.c @@ -1906,6 +1906,7 @@ cupsdSetPrinterAttr( if (!attr) { + free(temp); cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to allocate memory for printer attribute " "(%d values)", count); @@ -1956,6 +1957,7 @@ cupsdSetPrinterAttr( if (!attr) { + free(temp); cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to allocate memory for printer attribute " "(%d values)", count); |