mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 21:42:43 +00:00 
			
		
		
		
	Kernel: Make UDPSocket::create() API OOM safe
This commit is contained in:
		
							parent
							
								
									858fff979a
								
							
						
					
					
						commit
						2e34714ba1
					
				
					 3 changed files with 13 additions and 5 deletions
				
			
		|  | @ -42,8 +42,12 @@ KResultOr<NonnullRefPtr<Socket>> IPv4Socket::create(int type, int protocol) | |||
|             return tcp_socket.error(); | ||||
|         return tcp_socket.release_value(); | ||||
|     } | ||||
|     if (type == SOCK_DGRAM) | ||||
|         return UDPSocket::create(protocol); | ||||
|     if (type == SOCK_DGRAM) { | ||||
|         auto udp_socket = UDPSocket::create(protocol); | ||||
|         if (udp_socket.is_error()) | ||||
|             return udp_socket.error(); | ||||
|         return udp_socket.release_value(); | ||||
|     } | ||||
|     if (type == SOCK_RAW) { | ||||
|         auto raw_socket = adopt_ref_if_nonnull(new IPv4Socket(type, protocol)); | ||||
|         if (raw_socket) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Brian Gianforcaro
						Brian Gianforcaro