소스 검색

ipcc: Avoid leak of dup'ed client file descriptor

Clean up the dup'ed file descriptor on the error path.
Avoid leaking file descriptors in client applications
under error conditions such as the corosync daemon being down,
or low memory conditions.

Signed-off-by: dan clark <2clarkd@gmail.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
Dan Clark 12 년 전
부모
커밋
28013d3a62
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      lib/coroipcc.c

+ 2 - 0
lib/coroipcc.c

@@ -786,6 +786,8 @@ error_request_buffer:
 	memory_unmap (ipc_instance->control_buffer, 8192);
 	unlink (path_data->control_map_path);
 error_connect:
+	close (ipc_instance->user_app_fd);
+	ipc_instance->user_app_fd = -1;
 	close (request_fd);
 
 	hdb_handle_destroy (&ipc_hdb, *handle);