-const char cgi_rcs[] = "$Id: cgi.c,v 1.152 2012/06/08 15:08:33 fabiankeil Exp $";
+const char cgi_rcs[] = "$Id: cgi.c,v 1.153 2012/06/08 15:15:11 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/cgi.c,v $
*/
max_segments = 1;
}
- vector = malloc(max_segments * sizeof(char *));
-
- if (NULL == vector)
- {
- return NULL;
- }
+ vector = malloc_or_die(max_segments * sizeof(char *));
if (NULL == (cgi_params = new_map()))
{
rsp->head_length = 0;
rsp->is_static = 0;
- rsp->body = malloc(body_size);
- if (rsp->body == NULL)
- {
- return JB_ERR_MEMORY;
- }
+ rsp->body = malloc_or_die(body_size);
strlcpy(rsp->body, body_prefix, body_size);
strlcat(rsp->body, template_name, body_size);
strlcat(rsp->body, body_suffix, body_size);
rsp->is_static = 0;
rsp->crunch_reason = INTERNAL_ERROR;
- rsp->body = malloc(body_size);
- if (rsp->body == NULL)
- {
- return JB_ERR_MEMORY;
- }
+ rsp->body = malloc_or_die(body_size);
snprintf(rsp->body, body_size, "%s%d%s", body_prefix, error_to_report, body_suffix);
/* Let zlib figure out the maximum length of the compressed data */
new_length = compressBound((uLongf)*buffer_length);
- compressed_buffer = malloc(new_length);
- if (NULL == compressed_buffer)
- {
- log_error(LOG_LEVEL_FATAL,
- "Out of memory allocation compression buffer.");
- }
+ compressed_buffer = malloc_or_die(new_length);
if (Z_OK != compress2((Bytef *)compressed_buffer, &new_length,
(Bytef *)buffer, *buffer_length, compression_level))
-const char cgiedit_rcs[] = "$Id: cgiedit.c,v 1.74 2012/03/09 16:24:36 fabiankeil Exp $";
+const char cgiedit_rcs[] = "$Id: cgiedit.c,v 1.75 2012/03/09 17:55:49 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/cgiedit.c,v $
/* Allocate new memory for string */
len = strlen(cur_line->unprocessed) + (size_t)numhash;
- if (NULL == (str = malloc(len + 1)))
- {
- /* Uh oh, just trashed file! */
- fclose(fp);
- return JB_ERR_MEMORY;
- }
+ str = malloc_or_die(len + 1);
/* Copy string but quote hashes */
src = cur_line->unprocessed;
}
name_len = (size_t)(name_end - line) + 1; /* Length excluding \0 */
- if (NULL == (*pname = (char *) malloc(name_len + 1)))
- {
- return JB_ERR_MEMORY;
- }
+ *pname = malloc_or_die(name_len + 1);
strncpy(*pname, line, name_len);
(*pname)[name_len] = '\0';
cur_line->type = FILE_LINE_ACTION;
/* Remove {} and make copy */
- if (NULL == (value = (char *) malloc(len + 1)))
- {
- /* Out of memory */
- free_alias_list(alias_list);
- return JB_ERR_MEMORY;
- }
+ value = malloc_or_die(len + 1);
strncpy(value, text, len);
value[len] = '\0';
/* Append extension */
name_size = len + strlen(suffix) + 1;
- name = malloc(name_size);
- if (name == NULL)
- {
- return JB_ERR_MEMORY;
- }
+ name = malloc_or_die(name_size);
strlcpy(name, param, name_size);
strlcat(name, suffix, name_size);
assert(optionname);
assert(values);
- buf = malloc(buf_size);
- if (buf == NULL)
- {
- return JB_ERR_MEMORY;
- }
+ buf = malloc_or_die(buf_size);
strlcpy(buf, optionname, buf_size);
}
newtext_size = len + 2;
- if (NULL == (newtext = malloc(newtext_size)))
- {
- /* Out of memory */
- free(actiontext);
- edit_free_file(file);
- return JB_ERR_MEMORY;
- }
+ newtext = malloc_or_die(newtext_size);
strlcpy(newtext, actiontext, newtext_size);
free(actiontext);
newtext[0] = '{';
-const char jcc_rcs[] = "$Id: jcc.c,v 1.380 2012/07/23 12:39:42 fabiankeil Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.381 2012/07/23 12:40:52 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/jcc.c,v $
basedir = strdup_or_die(cwd);
/* XXX: why + 5? */
abs_file_size = strlen(cwd) + strlen(configfile) + 5;
- abs_file = malloc(abs_file_size);
- if (NULL == abs_file)
- {
- perror("malloc failed");
- exit(1);
- }
+ abs_file = malloc_or_die(abs_file_size);
strlcpy(abs_file, basedir, abs_file_size);
strlcat(abs_file, "/", abs_file_size);
strlcat(abs_file, configfile, abs_file_size);
-const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.70 2012/03/09 17:55:50 fabiankeil Exp $";
+const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.71 2012/06/08 15:15:11 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/urlmatch.c,v $
/* save a copy of the pointers in dvec */
size = (size_t)http->dcount * sizeof(*http->dvec);
- http->dvec = (char **)malloc(size);
- if (NULL == http->dvec)
- {
- return JB_ERR_MEMORY;
- }
+ http->dvec = malloc_or_die(size);
memcpy(http->dvec, vec, size);
*/
size = (size_t)url->dcount * sizeof(*url->dvec);
- url->dvec = (char **)malloc(size);
- if (NULL == url->dvec)
- {
- free_url_spec(url);
- return JB_ERR_MEMORY;
- }
+ url->dvec = malloc_or_die(size);
memcpy(url->dvec, v, size);
}