Changed all calls to strdup to safestrdup. This should provide better

memory usage tracking.
This commit is contained in:
Robert James Kaes 2002-04-18 17:59:21 +00:00
parent a66aae880c
commit 9a8d732a13
4 changed files with 9 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $Id: acl.c,v 1.13 2002-04-17 20:52:45 rjkaes Exp $ /* $Id: acl.c,v 1.14 2002-04-18 17:59:21 rjkaes Exp $
* *
* This system handles Access Control for use of this daemon. A list of * This system handles Access Control for use of this daemon. A list of
* domains, or IP addresses (including IP blocks) are stored in a list * domains, or IP addresses (including IP blocks) are stored in a list
@ -120,7 +120,7 @@ insert_acl(char *location, acl_access_t access_type)
new_acl_ptr->netmask = 32; new_acl_ptr->netmask = 32;
} }
new_acl_ptr->location = strdup(location); new_acl_ptr->location = safestrdup(location);
if (!new_acl_ptr->location) { if (!new_acl_ptr->location) {
safefree(new_acl_ptr); safefree(new_acl_ptr);
return -1; return -1;

View File

@ -1,4 +1,4 @@
/* $Id: filter.c,v 1.8 2001-11-22 00:31:10 rjkaes Exp $ /* $Id: filter.c,v 1.9 2002-04-18 17:59:21 rjkaes Exp $
* *
* Copyright (c) 1999 George Talusan (gstalusan@uwaterloo.ca) * Copyright (c) 1999 George Talusan (gstalusan@uwaterloo.ca)
* *
@ -67,7 +67,7 @@ filter_init(void)
if (isspace((unsigned char) *s)) if (isspace((unsigned char) *s))
*s = '\0'; *s = '\0';
p->pat = strdup(buf); p->pat = safestrdup(buf);
p->cpat = safemalloc(sizeof(regex_t)); p->cpat = safemalloc(sizeof(regex_t));
if ((err = if ((err =
regcomp(p->cpat, p->pat, regcomp(p->cpat, p->pat,
@ -114,7 +114,7 @@ filter_url(char *host)
return (0); return (0);
/* strip off the port number */ /* strip off the port number */
s = strdup(host); s = safestrdup(host);
port = strchr(s, ':'); port = strchr(s, ':');
if (port) if (port)
*port = '\0'; *port = '\0';

View File

@ -1,4 +1,4 @@
/* $Id: tinyproxy.c,v 1.26 2002-04-18 17:04:04 rjkaes Exp $ /* $Id: tinyproxy.c,v 1.27 2002-04-18 17:59:21 rjkaes Exp $
* *
* The initialise routine. Basically sets up all the initial stuff (logfile, * The initialise routine. Basically sets up all the initial stuff (logfile,
* listening socket, config options, etc.) and then sits there and loops * listening socket, config options, etc.) and then sits there and loops
@ -173,7 +173,7 @@ main(int argc, char **argv)
godaemon = FALSE; godaemon = FALSE;
break; break;
case 'c': case 'c':
conf_file = strdup(optarg); conf_file = safestrdup(optarg);
if (!conf_file) { if (!conf_file) {
fprintf(stderr, fprintf(stderr,
"%s: Could not allocate memory.\n", "%s: Could not allocate memory.\n",

View File

@ -1,4 +1,4 @@
/* $Id: utils.c,v 1.27 2002-04-18 17:49:14 rjkaes Exp $ /* $Id: utils.c,v 1.28 2002-04-18 17:59:21 rjkaes Exp $
* *
* Misc. routines which are used by the various functions to handle strings * Misc. routines which are used by the various functions to handle strings
* and memory allocation and pretty much anything else we can think of. Also, * and memory allocation and pretty much anything else we can think of. Also,
@ -198,7 +198,7 @@ send_http_error_message(struct conn_s *connptr)
int int
indicate_http_error(struct conn_s* connptr, int number, const char* string) indicate_http_error(struct conn_s* connptr, int number, const char* string)
{ {
connptr->error_string = strdup(string); connptr->error_string = safestrdup(string);
if (!connptr->error_string) if (!connptr->error_string)
return -1; return -1;
connptr->error_number = number; connptr->error_number = number;