- fixed some memory leaks

This commit is contained in:
Uwe Steinmann 1999-10-06 05:31:24 +00:00
parent 0817d2a8db
commit 3ec401ec84
2 changed files with 18 additions and 12 deletions

View file

@ -4425,13 +4425,13 @@ int send_putdocument(int sockfd, char *host, hw_objectID parentID, char *objectR
if ( send_hg_msg(sockfd, &msg, length) == -1 ) { if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
efree(msg.buf); efree(msg.buf);
return(-1); return(-2);
} }
efree(msg.buf); efree(msg.buf);
retmsg = recv_hg_msg(sockfd); retmsg = recv_hg_msg(sockfd);
if ( retmsg == NULL ) { if ( retmsg == NULL ) {
return(-1); return(-3);
} }
ptr = (int *) retmsg->buf; 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) { if((hostptr = gethostbyname(host)) == NULL) {
php3_error(E_WARNING, "gethostbyname failed for %s", host); php3_error(E_WARNING, "gethostbyname failed for %s", host);
/* close(fd); fd is not set yet */ /* close(fd); fd is not set yet */
return(-1); return(-4);
} }
} else { } else {
/* close(fd); fd is not set yet */ /* close(fd); fd is not set yet */
return(-1); return(-5);
} }
switch(hostptr->h_addrtype) { 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))) { if(-1 == (fd = fnCOpenDataCon(sockfd, &port))) {
efree(msg.buf); efree(msg.buf);
return(-1); return(-6);
} }
/* Start building the PUTDOCUMENT message. I works even if /* 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 ) { if ( (msg.buf = (char *)emalloc(length-HEADER_LENGTH)) == NULL ) {
lowerror = LE_MALLOC; lowerror = LE_MALLOC;
return(-1); return(-7);
} }
tmp = build_msg_int(msg.buf, *objectID); 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 ) { if ( send_hg_msg(sockfd, &msg, length) == -1 ) {
efree(msg.buf); efree(msg.buf);
HWSOCK_FCLOSE(fd); HWSOCK_FCLOSE(fd);
return(-1); return(-8);
} }
efree(msg.buf); efree(msg.buf);
@ -4509,7 +4509,7 @@ int send_putdocument(int sockfd, char *host, hw_objectID parentID, char *objectR
len = sizeof(serv_addr); len = sizeof(serv_addr);
if((newfd = accept(fd, (struct sockaddr *) &serv_addr, &len)) < 0) { if((newfd = accept(fd, (struct sockaddr *) &serv_addr, &len)) < 0) {
HWSOCK_FCLOSE(fd); HWSOCK_FCLOSE(fd);
return(-1); return(-9);
} else { } else {
HWSOCK_FCLOSE(fd); HWSOCK_FCLOSE(fd);
} }
@ -4524,13 +4524,13 @@ int send_putdocument(int sockfd, char *host, hw_objectID parentID, char *objectR
len = strlen(header) + 1; len = strlen(header) + 1;
if(len != write_to(newfd, header, len, wtimeout)) { if(len != write_to(newfd, header, len, wtimeout)) {
HWSOCK_FCLOSE(newfd); HWSOCK_FCLOSE(newfd);
return(-1); return(-10);
} }
/* And now the document */ /* And now the document */
if(count != write_to(newfd, text, count, wtimeout)) { if(count != write_to(newfd, text, count, wtimeout)) {
HWSOCK_FCLOSE(newfd); HWSOCK_FCLOSE(newfd);
return(-1); return(-11);
} }
/* The data connection has to be close before the return /* 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); retmsg = recv_hg_msg(sockfd);
if ( retmsg == NULL ) { if ( retmsg == NULL ) {
HWSOCK_FCLOSE(fd); HWSOCK_FCLOSE(fd);
return(-1); return(-12);
} }
ptr = (int *) retmsg->buf; 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); if(retmsg->buf) efree(retmsg->buf);
efree(retmsg); efree(retmsg);
HWSOCK_FCLOSE(fd); HWSOCK_FCLOSE(fd);
return(-1); return(-13);
} }
efree(retmsg->buf); efree(retmsg->buf);

View file

@ -371,6 +371,12 @@ int make2_return_array_from_objrec(pval **return_value, char *objrec, zval *sarr
attrname = strtok(NULL, "\n"); 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); efree(temp);
return(0); return(0);