[asterisk-commits] trunk r15026 - /trunk/http.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Mar 26 09:55:36 MST 2006


Author: russell
Date: Sun Mar 26 10:55:34 2006
New Revision: 15026

URL: http://svn.digium.com/view/asterisk?rev=15026&view=rev
Log:
use ast_calloc instead of calloc, and do a little bit of tweaking on the code formatting

Modified:
    trunk/http.c

Modified: trunk/http.c
URL: http://svn.digium.com/view/asterisk/trunk/http.c?rev=15026&r1=15025&r2=15026&view=diff
==============================================================================
--- trunk/http.c (original)
+++ trunk/http.c Sun Mar 26 10:55:34 2006
@@ -297,23 +297,21 @@
 				ast_log(LOG_WARNING, "Accept failed: %s\n", strerror(errno));
 			continue;
 		}
-		ser = calloc(1, sizeof(*ser));
-		if (ser) {
-			ser->fd = fd;
-			if ((ser->f = fdopen(ser->fd, "w+"))) {
-				if (ast_pthread_create(&launched, NULL, ast_httpd_helper_thread, ser)) {
-					ast_log(LOG_WARNING, "Unable to launch helper thread: %s\n", strerror(errno));
-					fclose(ser->f);
-					free(ser);
-				}
-			} else {
-				ast_log(LOG_WARNING, "fdopen failed!\n");
-				close(ser->fd);
+		if (!(ser = ast_calloc(1, sizeof(*ser)))) {
+			close(fd);
+			continue;
+		}
+		ser->fd = fd;
+		if ((ser->f = fdopen(ser->fd, "w+"))) {
+			if (ast_pthread_create(&launched, NULL, ast_httpd_helper_thread, ser)) {
+				ast_log(LOG_WARNING, "Unable to launch helper thread: %s\n", strerror(errno));
+				fclose(ser->f);
 				free(ser);
 			}
 		} else {
-			ast_log(LOG_WARNING, "Out of memory!\n");
-			close(fd);
+			ast_log(LOG_WARNING, "fdopen failed!\n");
+			close(ser->fd);
+			free(ser);
 		}
 	}
 	return NULL;



More information about the asterisk-commits mailing list