axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From susan...@apache.org
Subject cvs commit: ws-axis/c/src/server/simple_axis_server SimpleAxisServer.cpp
Date Wed, 07 Apr 2004 11:58:58 GMT
susantha    2004/04/07 04:58:58

  Modified:    c/src/server/simple_axis_server SimpleAxisServer.cpp
  Log:
  Fixed server crashing bug when the message size is greater than 1000 bytes
  Fixed some memory leaks
  
  Revision  Changes    Path
  1.18      +12 -4     ws-axis/c/src/server/simple_axis_server/SimpleAxisServer.cpp
  
  Index: SimpleAxisServer.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/server/simple_axis_server/SimpleAxisServer.cpp,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- SimpleAxisServer.cpp	5 Apr 2004 07:11:11 -0000	1.17
  +++ SimpleAxisServer.cpp	7 Apr 2004 11:58:58 -0000	1.18
  @@ -119,9 +119,10 @@
   	
   	int iMsgSize = strlen(buffer);
   	char pchContentLength[4];
  -	_itoa(iMsgSize, pchContentLength, 10);
  +	sprintf(pchContentLength, "%d", iMsgSize);
   
  -	char res[1000]= {'\0'};
  +	char *res = (char*) malloc(iMsgSize + 200);
  +	res[0] = 0;
   	strcpy(res, "HTTP/1.1 200 OK\nDate: Wed, 03 Sep 2003 09:23:06 GMT\nContent-Length: ");
   	strcat(res, pchContentLength);
   	strcat(res, "\nContent-Type: text/xml\r\n\r\n");
  @@ -132,9 +133,11 @@
   	//AXISTRACE3(res);
   	
   	if (send(iClntSocket, res, strlen(res), 0) == AXIS_SOCKET_ERROR) {
  +		free(res);
   		printf("%s\n","send() failed");	
   		return TRANSPORT_FAILED;
   	} else {
  +		free(res);
   		return TRANSPORT_FINISHED;
   	}
   
  @@ -448,11 +451,11 @@
   	//AXISTRACE3(sHTTPBody.c_str());
   	//AXISTRACE3("----------END extracted HTTP Body-----------------");
   
  -	str->so.http->uri_path = map_HTTP_Headers[HMK_URI]->objuHttpMapContent->msValue;
  +	str->so.http->uri_path = strdup(map_HTTP_Headers[HMK_URI]->objuHttpMapContent->msValue);
   
   	str->so.http->ip_headercount = iHeaderCount;  
   
  -	str->so.http->ip_headers = new Ax_header();
  +	str->so.http->ip_headers = (Ax_header*)malloc(sizeof(Ax_header));
   	str->so.http->ip_headers = (Ax_header*)(g_pHttpHeaders);
   
   	switch (map_HTTP_Headers[HMK_METHOD]->objuHttpMapContent->eHTTP_KEYWORD)
  @@ -471,6 +474,11 @@
   	iClntSocket = clntSocket;
   
   	executeWork(str);
  +	/* De-allocate the memory */
  +	free(str->so.http->ip_headers);
  +	free(str->so.http->uri_path);	
  +	free(str->so.http);
  +	free(str);
   
   	releaseStuff();
   
  
  
  

Mime
View raw message