Check-in [f8df53b1e3]
Overview
Comment:Fixed potential (but unlikely) memory leaks related to logging
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f8df53b1e3083eff983456a8dc20f8e883572d9b
User & Date: rkeene on 2014-02-18 05:18:57
Other Links: manifest | tags
Context
2014-02-18
05:21
Updated to log fdopen failures instead of silently ignoring them check-in: df2de34e2e user: rkeene tags: trunk
05:18
Fixed potential (but unlikely) memory leaks related to logging check-in: f8df53b1e3 user: rkeene tags: trunk
05:16
More logging optimizations check-in: 937df4b0c8 user: rkeene tags: trunk
Changes

Modified filed.c from [865feafa0e] to [386b3803b7].

825
826
827
828
829
830
831


832
833
834
835
836
837
838
	date_current = filed_format_time(date_current_b, sizeof(date_current_b), time(NULL));

	/* Open socket as ANSI I/O for ease of use */
	fp = fdopen(fd, "w+b");
	if (fp == NULL) {
		close(fd);



		return;
	}

	request = filed_get_http_request(fp, request, options);

	if (request == NULL) {
		filed_error_page(fp, date_current, 500, FILED_REQUEST_METHOD_GET);







>
>







825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
	date_current = filed_format_time(date_current_b, sizeof(date_current_b), time(NULL));

	/* Open socket as ANSI I/O for ease of use */
	fp = fdopen(fd, "w+b");
	if (fp == NULL) {
		close(fd);

		free(log);

		return;
	}

	request = filed_get_http_request(fp, request, options);

	if (request == NULL) {
		filed_error_page(fp, date_current, 500, FILED_REQUEST_METHOD_GET);
1046
1047
1048
1049
1050
1051
1052


1053
1054
1055
1056
1057
1058
1059
		 * accept() failing
		 */
		if (fd < 0) {
			/* Log the new connection */
			filed_log_msg("ACCEPT_FAILED");

			failure_count++;



			continue;
		}

		/* Fill in log structure */
		if (filed_log_ip((struct sockaddr *) &addr, log->ip, sizeof(log->ip)) == NULL) {
			log->ip[0] = '\0';







>
>







1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
		 * accept() failing
		 */
		if (fd < 0) {
			/* Log the new connection */
			filed_log_msg("ACCEPT_FAILED");

			failure_count++;

			free(log);

			continue;
		}

		/* Fill in log structure */
		if (filed_log_ip((struct sockaddr *) &addr, log->ip, sizeof(log->ip)) == NULL) {
			log->ip[0] = '\0';