| |
@@ -118,9 +118,10 @@
|
| |
const char *ssldir = NULL, *cainfo = NULL, *capath = NULL;
|
| |
const char *sslcert = NULL, *sslkey = NULL;
|
| |
const char *sslpin = NULL, *sslpinfile = NULL;
|
| |
- const char *csr = NULL, *serial = NULL, *template = NULL;
|
| |
+ const char *serial = NULL, *template = NULL;
|
| |
const char *uid = NULL, *pwd = NULL, *pwdfile = NULL;
|
| |
const char *udn = NULL, *pin = NULL, *pinfile = NULL;
|
| |
+ char *csr = NULL, *csre = NULL;
|
| |
char *poptarg;
|
| |
struct {
|
| |
char *name;
|
| |
@@ -226,17 +227,22 @@
|
| |
if (strchr(poptarg, '=') == NULL) {
|
| |
printf(_("Profile params (-O) must be in the form of param=value.\n"));
|
| |
poptPrintUsage(pctx, stdout, 0);
|
| |
+ free(soptions);
|
| |
+ free(aoptions);
|
| |
return CM_SUBMIT_STATUS_UNCONFIGURED;
|
| |
}
|
| |
aoptions = realloc(aoptions,
|
| |
++num_aoptions * sizeof(*aoptions));
|
| |
if (aoptions == NULL) {
|
| |
printf(_("Out of memory.\n"));
|
| |
+ free(soptions);
|
| |
return CM_SUBMIT_STATUS_UNCONFIGURED;
|
| |
}
|
| |
p = strdup(poptarg);
|
| |
if (p == NULL) {
|
| |
printf(_("Out of memory.\n"));
|
| |
+ free(aoptions);
|
| |
+ free(soptions);
|
| |
return CM_SUBMIT_STATUS_UNCONFIGURED;
|
| |
}
|
| |
i = strcspn(p, "=");
|
| |
@@ -249,17 +255,21 @@
|
| |
if (strchr(poptarg, '=') == NULL) {
|
| |
printf(_("Submit params (-o) must be in the form of param=value.\n"));
|
| |
poptPrintUsage(pctx, stdout, 0);
|
| |
+ free(soptions);
|
| |
+ free(aoptions);
|
| |
return CM_SUBMIT_STATUS_UNCONFIGURED;
|
| |
}
|
| |
soptions = realloc(soptions,
|
| |
++num_soptions * sizeof(*soptions));
|
| |
if (soptions == NULL) {
|
| |
printf(_("Out of memory.\n"));
|
| |
+ free(aoptions);
|
| |
return CM_SUBMIT_STATUS_UNCONFIGURED;
|
| |
}
|
| |
p = strdup(poptarg);
|
| |
if (p == NULL) {
|
| |
printf(_("Out of memory.\n"));
|
| |
+ free(soptions);
|
| |
return CM_SUBMIT_STATUS_UNCONFIGURED;
|
| |
}
|
| |
i = strcspn(p, "=");
|
| |
@@ -293,6 +303,8 @@
|
| |
}
|
| |
if (c != -1) {
|
| |
poptPrintUsage(pctx, stdout, 0);
|
| |
+ free(soptions);
|
| |
+ free(aoptions);
|
| |
return CM_SUBMIT_STATUS_UNCONFIGURED;
|
| |
}
|
| |
|
| |
@@ -472,6 +484,8 @@
|
| |
op = op_retrieve;
|
| |
}
|
| |
params = talloc_asprintf(ctx, "requestId=%s", q);
|
| |
+ free(p);
|
| |
+ free(q);
|
| |
} else {
|
| |
params = "";
|
| |
}
|
| |
@@ -548,6 +562,7 @@
|
| |
"xml=true",
|
| |
template,
|
| |
csr);
|
| |
+ free(csr);
|
| |
}
|
| |
/* Check for creds specified as options. */
|
| |
for (j = 0; j < num_soptions; j++) {
|
| |
@@ -564,6 +579,7 @@
|
| |
pin = NULL;
|
| |
}
|
| |
}
|
| |
+ free(soptions);
|
| |
/* Add client creds. */
|
| |
if (uid != NULL) {
|
| |
uid = cm_submit_u_url_encode(uid);
|
| |
Address an array of memory leaks, dead code, uninitialized values, unchecked return values and more.
Most of the memory leaks aren't really a problem since they occur in short-lived helpers but it reduces the total number of warnings/errors reported by the scanning tools which makes finding any real problems a lot easier.