port: Fix memory leaks.
In port_management_fill_response() the TLV descriptor leaked when not responding. In port_open() the port would leak with the unsupported management clock type. Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
This commit is contained in:
		
							parent
							
								
									d08bee2771
								
							
						
					
					
						commit
						47971bdd50
					
				
							
								
								
									
										3
									
								
								port.c
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								port.c
									
									
									
									
									
								
							@ -914,6 +914,7 @@ static int port_management_fill_response(struct port *target,
 | 
			
		||||
		break;
 | 
			
		||||
	default:
 | 
			
		||||
		/* The caller should *not* respond to this message. */
 | 
			
		||||
		tlv_extra_recycle(extra);
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -2844,7 +2845,7 @@ struct port *port_open(int phc_index,
 | 
			
		||||
		p->event = e2e_event;
 | 
			
		||||
		break;
 | 
			
		||||
	case CLOCK_TYPE_MANAGEMENT:
 | 
			
		||||
		return NULL;
 | 
			
		||||
		goto err_port;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	p->state_machine = clock_slave_only(clock) ? ptp_slave_fsm : ptp_fsm;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user