cvs: php4 /main network.c

From: Date: Tue, 05 Sep 2000 17:37:44 +0000
Subject: cvs: php4 /main network.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-1582@lists.php.net to get a copy of this message
venaas Tue Sep 5 10:37:44 2000 EDT Modified files: /php4/main network.c Log: using emalloc and efree, instead of malloc and free Index: php4/main/network.c diff -u php4/main/network.c:1.5 php4/main/network.c:1.6 --- php4/main/network.c:1.5 Tue Sep 5 09:36:56 2000 +++ php4/main/network.c Tue Sep 5 10:37:44 2000 @@ -15,7 +15,7 @@ | Authors: Stig Venaas <venaas@uninett.no> | +----------------------------------------------------------------------+ */ -/* $Id: network.c,v 1.5 2000/09/05 16:36:56 venaas Exp $ */ +/* $Id: network.c,v 1.6 2000/09/05 17:37:44 venaas Exp $ */ #include "php.h" @@ -62,8 +62,8 @@ if (sal == NULL) return; for (sap = sal; *sap != NULL; sap++) - free(*sap); - free(sal); + efree(*sap); + efree(sal); } static int php_network_getaddresses(const char *host, struct sockaddr ***sal) @@ -81,7 +81,7 @@ return -1; sai = res; for (n=2; (sai = sai->ai_next) != NULL; n++); - *sal = malloc(n * sizeof(*sal)); + *sal = emalloc(n * sizeof(*sal)); if (*sal == NULL) return -1; @@ -91,7 +91,7 @@ switch (sai->ai_family) { # ifdef AF_INET6 case AF_INET6: { - *sap = malloc(sizeof(struct sockaddr_in6)); + *sap = emalloc(sizeof(struct sockaddr_in6)); if (*sap == NULL) { freeaddrinfo(res); goto errexit; @@ -101,7 +101,7 @@ } break; # endif case AF_INET: { - *sap = malloc(sizeof(struct sockaddr_in)); + *sap = emalloc(sizeof(struct sockaddr_in)); if (*sap == NULL) { freeaddrinfo(res); goto errexit; @@ -125,11 +125,11 @@ in = *((struct in_addr *) host_info->h_addr); } - *sal = malloc(2 * sizeof(*sal)); + *sal = emalloc(2 * sizeof(*sal)); if (*sal == NULL) return -1; sap = *sal; - *sap = malloc(sizeof(struct sockaddr_in)); + *sap = emalloc(sizeof(struct sockaddr_in)); if (*sap == NULL) goto errexit;

« previous php.cvs (#1582) next »