In httpd/APR it is best practice to assume that memory allocation always
succeeds, which simplifies module code.
APR internally calls abort() if memory allocation ever actually fails,
so in pratice you cannot trigger these code paths anyway.
Reviewed-by: Simo Sorce <simo@redhat.com>
struct mag_conn *mc;
mc = apr_pcalloc(c->pool, sizeof(struct mag_conn));
struct mag_conn *mc;
mc = apr_pcalloc(c->pool, sizeof(struct mag_conn));
- if (!mc) return DECLINED;
mc->parent = c->pool;
ap_set_module_config(c->conn_config, &auth_gssapi_module, (void*)mc);
mc->parent = c->pool;
ap_set_module_config(c->conn_config, &auth_gssapi_module, (void*)mc);
char *p;
namecopy = apr_pstrdup(pool, name);
char *p;
namecopy = apr_pstrdup(pool, name);
- if (!namecopy) goto done;
p = strchr(namecopy, find);
if (!p) return namecopy;
p = strchr(namecopy, find);
if (!p) return namecopy;
} else {
escaped = apr_pstrcat(pool, n, replace, NULL);
}
} else {
escaped = apr_pstrcat(pool, n, replace, NULL);
}
- if (!escaped) goto done;
/* move to next segment */
n = p + 1;
p = strchr(n, find);
/* move to next segment */
n = p + 1;
p = strchr(n, find);
escaped = apr_pstrcat(pool, escaped, n, NULL);
}
escaped = apr_pstrcat(pool, escaped, n, NULL);
}
-done:
- if (!escaped) {
- ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, NULL,
- "OOM escaping name");
- }
if (!escaped) return;
value = apr_psprintf(req->pool, "FILE:%s/%s", dir, escaped);
if (!escaped) return;
value = apr_psprintf(req->pool, "FILE:%s/%s", dir, escaped);
- if (!value) {
- ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, NULL,
- "OOM storing delegated credentials");
- return;
- }
element.key = "ccache";
element.value = value;
element.key = "ccache";
element.value = value;
struct mag_config *cfg;
cfg = (struct mag_config *)apr_pcalloc(p, sizeof(struct mag_config));
struct mag_config *cfg;
cfg = (struct mag_config *)apr_pcalloc(p, sizeof(struct mag_config));
cfg->pool = p;
return cfg;
cfg->pool = p;
return cfg;
if (cfg->deleg_ccache_dir == NULL) {
cfg->deleg_ccache_dir = apr_pstrdup(parms->pool, "/tmp");
if (cfg->deleg_ccache_dir == NULL) {
cfg->deleg_ccache_dir = apr_pstrdup(parms->pool, "/tmp");
- if (!cfg->deleg_ccache_dir) {
- ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0,
- parms->server, "%s", "OOM setting deleg_ccache_dir.");
- }
l = apr_base64_decode_len(k);
val = apr_palloc(parms->temp_pool, l);
l = apr_base64_decode_len(k);
val = apr_palloc(parms->temp_pool, l);
- if (!val) {
- ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, parms->server,
- "Failed to get memory to decode key");
- return NULL;
- }
keys.length = (int)apr_base64_decode_binary(val, k);
keys.value = (unsigned char *)val;
keys.length = (int)apr_base64_decode_binary(val, k);
keys.value = (unsigned char *)val;
key = apr_pstrndup(parms->pool, w, (p-w));
value = apr_pstrdup(parms->pool, p + 1);
key = apr_pstrndup(parms->pool, w, (p-w));
value = apr_pstrdup(parms->pool, p + 1);
- if (!key || !value) {
- ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, parms->server,
- "%s", "OOM handling GssapiCredStore option");
- return NULL;
- }
if (!cfg->cred_store) {
cfg->cred_store = apr_pcalloc(parms->pool,
sizeof(gss_key_value_set_desc));
if (!cfg->cred_store) {
cfg->cred_store = apr_pcalloc(parms->pool,
sizeof(gss_key_value_set_desc));
- if (!cfg->cred_store) {
- ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, parms->server,
- "%s", "OOM handling GssapiCredStore option");
- return NULL;
- }
size = sizeof(gss_key_value_element_desc) * MAX_CRED_OPTIONS;
cfg->cred_store->elements = apr_palloc(parms->pool, size);
size = sizeof(gss_key_value_element_desc) * MAX_CRED_OPTIONS;
cfg->cred_store->elements = apr_palloc(parms->pool, size);
- if (!cfg->cred_store->elements) {
- ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, parms->server,
- "%s", "OOM handling GssapiCredStore option");
- }
}
elements = cfg->cred_store->elements;
}
elements = cfg->cred_store->elements;
struct mag_config *cfg = (struct mag_config *)mconfig;
cfg->deleg_ccache_dir = apr_pstrdup(parms->pool, value);
struct mag_config *cfg = (struct mag_config *)mconfig;
cfg->deleg_ccache_dir = apr_pstrdup(parms->pool, value);
- if (!cfg->deleg_ccache_dir) {
- ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, parms->server,
- "%s", "OOM handling GssapiDelegCcacheDir option");
- }