diff options
author | Michael R Sweet <michael.r.sweet@gmail.com> | 2019-04-20 09:13:32 -0400 |
---|---|---|
committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2019-04-20 09:13:32 -0400 |
commit | 507c4adcc817c2d80643ecee2cb55dff305236f9 (patch) | |
tree | 0b4567e44b8a7af86fa75409858f76976bb82d80 /scheduler | |
parent | 60d8f88456d1240720cec82ff7375dff439da56e (diff) | |
download | cups-507c4adcc817c2d80643ecee2cb55dff305236f9.tar.gz |
More clang warning fixes.
Diffstat (limited to 'scheduler')
-rw-r--r-- | scheduler/cups-driverd.cxx | 3 | ||||
-rw-r--r-- | scheduler/job.c | 9 | ||||
-rw-r--r-- | scheduler/main.c | 1 | ||||
-rw-r--r-- | scheduler/type.c | 15 |
4 files changed, 15 insertions, 13 deletions
diff --git a/scheduler/cups-driverd.cxx b/scheduler/cups-driverd.cxx index 07e78a49d..85516eb8c 100644 --- a/scheduler/cups-driverd.cxx +++ b/scheduler/cups-driverd.cxx @@ -347,8 +347,7 @@ cat_drv(const char *name, /* I - PPD name */ return (1); } - if ((fp = get_file(resource, request_id, "drv", filename, sizeof(filename), - &pc_file_name)) == NULL) + if ((fp = get_file(resource, request_id, "drv", filename, sizeof(filename), &pc_file_name)) == NULL || !pc_file_name) return (1); src = new ppdcSource(filename, fp); diff --git a/scheduler/job.c b/scheduler/job.c index 092d87962..26cffdb61 100644 --- a/scheduler/job.c +++ b/scheduler/job.c @@ -1303,9 +1303,7 @@ cupsdContinueJob(cupsd_job_t *job) /* I - Job */ cupsdClosePipe(filterfds[slot]); for (i = 6; i < argc; i ++) - if (argv[i]) - free(argv[i]); - + free(argv[i]); free(argv); if (printer_state_reasons) @@ -1338,8 +1336,9 @@ cupsdContinueJob(cupsd_job_t *job) /* I - Job */ if (argv) { for (i = 6; i < argc; i ++) - if (argv[i]) - free(argv[i]); + free(argv[i]); + + free(argv); } if (printer_state_reasons) diff --git a/scheduler/main.c b/scheduler/main.c index 616cf2c37..3a2fe7ec9 100644 --- a/scheduler/main.c +++ b/scheduler/main.c @@ -345,6 +345,7 @@ main(int argc, /* I - Number of command-line args */ strlcpy(filename, ConfigurationFile, len); if ((slash = strrchr(filename, '/')) == NULL) { + free(filename); _cupsLangPrintf(stderr, _("cupsd: Unable to get path to " "cups-files.conf file.")); diff --git a/scheduler/type.c b/scheduler/type.c index 2cceeda58..5df77e9bf 100644 --- a/scheduler/type.c +++ b/scheduler/type.c @@ -1,10 +1,11 @@ /* * MIME typing routines for CUPS. * - * Copyright 2007-2016 by Apple Inc. - * Copyright 1997-2006 by Easy Software Products, all rights reserved. + * Copyright © 2007-2019 by Apple Inc. + * Copyright © 1997-2006 by Easy Software Products, all rights reserved. * - * Licensed under Apache License v2.0. See the file "LICENSE" for more information. + * Licensed under Apache License v2.0. See the file "LICENSE" for more + * information. */ /* @@ -527,14 +528,16 @@ mimeAddTypeRule(mime_type_t *mt, /* I - Type to add to */ case MIME_MAGIC_STRING : case MIME_MAGIC_ISTRING : temp->offset = strtol(value[0], NULL, 0); - if ((size_t)length[1] > sizeof(temp->value.stringv)) + if (num_values < 2 || (size_t)length[1] > sizeof(temp->value.stringv)) return (-1); temp->length = length[1]; memcpy(temp->value.stringv, value[1], (size_t)length[1]); break; case MIME_MAGIC_CHAR : temp->offset = strtol(value[0], NULL, 0); - if (length[1] == 1) + if (num_values < 2) + return (-1); + else if (length[1] == 1) temp->value.charv = (unsigned char)value[1][0]; else temp->value.charv = (unsigned char)strtol(value[1], NULL, 0); @@ -559,7 +562,7 @@ mimeAddTypeRule(mime_type_t *mt, /* I - Type to add to */ case MIME_MAGIC_CONTAINS : temp->offset = strtol(value[0], NULL, 0); temp->region = strtol(value[1], NULL, 0); - if ((size_t)length[2] > sizeof(temp->value.stringv)) + if (num_values < 3 || (size_t)length[2] > sizeof(temp->value.stringv)) return (-1); temp->length = length[2]; memcpy(temp->value.stringv, value[2], (size_t)length[2]); |