You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by Chuck Murcko <ch...@hyperreal.com> on 1997/06/01 00:43:03 UTC

cvs commit: apache/src/modules/proxy proxy_util.c

chuck       97/05/31 15:43:02

  Modified:    src/modules/proxy  proxy_util.c
  Log:
  Submitted by:	Jozsef Hollosi <ho...@sbcm.com>
  Cleanup to remove malloc() from proxy_host2addr.
  
  Revision  Changes    Path
  1.16      +2 -3      apache/src/modules/proxy/proxy_util.c
  
  Index: proxy_util.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/modules/proxy/proxy_util.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -C3 -r1.15 -r1.16
  *** proxy_util.c	1997/05/29 06:23:36	1.15
  --- proxy_util.c	1997/05/31 22:43:00	1.16
  ***************
  *** 701,706 ****
  --- 701,707 ----
        struct hostent *hp;
        static struct hostent hpbuf;
        static u_long ipaddr;
  +     static char* charpbuf[2];
    
        for (i=0; host[i] != '\0'; i++)
    	if (!isdigit(host[i]) && host[i] != '.')
  ***************
  *** 720,734 ****
    	    hpbuf.h_name = 0;
    	    hpbuf.h_addrtype = AF_INET;
    	    hpbuf.h_length = sizeof(u_long);
  ! 	    hpbuf.h_addr_list = malloc(2 * sizeof(char*));
    	    hpbuf.h_addr_list[0] = (char*)&ipaddr;
    	    hpbuf.h_addr_list[1] = 0;
    	    hp = &hpbuf;
    	}
        }
        memcpy(reqhp, hp, sizeof(struct hostent));
  -     if (hpbuf.h_addr_list != NULL)
  - 	free(hpbuf.h_addr_list);
        return NULL;
    }
    
  --- 721,733 ----
    	    hpbuf.h_name = 0;
    	    hpbuf.h_addrtype = AF_INET;
    	    hpbuf.h_length = sizeof(u_long);
  ! 	    hpbuf.h_addr_list = charpbuf;
    	    hpbuf.h_addr_list[0] = (char*)&ipaddr;
    	    hpbuf.h_addr_list[1] = 0;
    	    hp = &hpbuf;
    	}
        }
        memcpy(reqhp, hp, sizeof(struct hostent));
        return NULL;
    }