summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUwe Steinmann <steinm@php.net>1999-10-06 05:31:24 +0000
committerUwe Steinmann <steinm@php.net>1999-10-06 05:31:24 +0000
commit3ec401ec842fceb0c4ee4794533964a8d75a126f (patch)
treec0643ee71cf31ff7086e22a328a00289319463b2
parent0817d2a8db90a9119e3399789a16aa9a6423a454 (diff)
downloadphp-git-3ec401ec842fceb0c4ee4794533964a8d75a126f.tar.gz
- fixed some memory leaks
-rw-r--r--ext/hyperwave/hg_comm.c24
-rw-r--r--ext/hyperwave/hw.c6
2 files changed, 18 insertions, 12 deletions
diff --git a/ext/hyperwave/hg_comm.c b/ext/hyperwave/hg_comm.c
index 89b78ebdef..874c2e52d4 100644
--- a/ext/hyperwave/hg_comm.c
+++ b/ext/hyperwave/hg_comm.c
@@ -4425,13 +4425,13 @@ int send_putdocument(int sockfd, char *host, hw_objectID parentID, char *objectR
if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
efree(msg.buf);
- return(-1);
+ return(-2);
}
efree(msg.buf);
retmsg = recv_hg_msg(sockfd);
if ( retmsg == NULL ) {
- return(-1);
+ return(-3);
}
ptr = (int *) retmsg->buf;
@@ -4454,11 +4454,11 @@ int send_putdocument(int sockfd, char *host, hw_objectID parentID, char *objectR
if((hostptr = gethostbyname(host)) == NULL) {
php3_error(E_WARNING, "gethostbyname failed for %s", host);
/* close(fd); fd is not set yet */
- return(-1);
+ return(-4);
}
} else {
/* close(fd); fd is not set yet */
- return(-1);
+ return(-5);
}
switch(hostptr->h_addrtype) {
@@ -4476,7 +4476,7 @@ int send_putdocument(int sockfd, char *host, hw_objectID parentID, char *objectR
if(-1 == (fd = fnCOpenDataCon(sockfd, &port))) {
efree(msg.buf);
- return(-1);
+ return(-6);
}
/* Start building the PUTDOCUMENT message. I works even if
@@ -4487,7 +4487,7 @@ int send_putdocument(int sockfd, char *host, hw_objectID parentID, char *objectR
if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
lowerror = LE_MALLOC;
- return(-1);
+ return(-7);
}
tmp = build_msg_int(msg.buf, *objectID);
@@ -4499,7 +4499,7 @@ int send_putdocument(int sockfd, char *host, hw_objectID parentID, char *objectR
if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
efree(msg.buf);
HWSOCK_FCLOSE(fd);
- return(-1);
+ return(-8);
}
efree(msg.buf);
@@ -4509,7 +4509,7 @@ int send_putdocument(int sockfd, char *host, hw_objectID parentID, char *objectR
len = sizeof(serv_addr);
if((newfd = accept(fd, (struct sockaddr *) &serv_addr, &len)) < 0) {
HWSOCK_FCLOSE(fd);
- return(-1);
+ return(-9);
} else {
HWSOCK_FCLOSE(fd);
}
@@ -4524,13 +4524,13 @@ int send_putdocument(int sockfd, char *host, hw_objectID parentID, char *objectR
len = strlen(header) + 1;
if(len != write_to(newfd, header, len, wtimeout)) {
HWSOCK_FCLOSE(newfd);
- return(-1);
+ return(-10);
}
/* And now the document */
if(count != write_to(newfd, text, count, wtimeout)) {
HWSOCK_FCLOSE(newfd);
- return(-1);
+ return(-11);
}
/* The data connection has to be close before the return
@@ -4541,7 +4541,7 @@ int send_putdocument(int sockfd, char *host, hw_objectID parentID, char *objectR
retmsg = recv_hg_msg(sockfd);
if ( retmsg == NULL ) {
HWSOCK_FCLOSE(fd);
- return(-1);
+ return(-12);
}
ptr = (int *) retmsg->buf;
@@ -4549,7 +4549,7 @@ int send_putdocument(int sockfd, char *host, hw_objectID parentID, char *objectR
if(retmsg->buf) efree(retmsg->buf);
efree(retmsg);
HWSOCK_FCLOSE(fd);
- return(-1);
+ return(-13);
}
efree(retmsg->buf);
diff --git a/ext/hyperwave/hw.c b/ext/hyperwave/hw.c
index 8b4e13702f..8beeb5715f 100644
--- a/ext/hyperwave/hw.c
+++ b/ext/hyperwave/hw.c
@@ -371,6 +371,12 @@ int make2_return_array_from_objrec(pval **return_value, char *objrec, zval *sarr
attrname = strtok(NULL, "\n");
}
+ if(NULL == sarr){
+ spec_arr->refcount--;
+ zend_hash_destroy(spec_arr->value.ht);
+ efree(spec_arr->value.ht);
+ efree(spec_arr);
+ }
efree(temp);
return(0);