forked from osmocom/wireshark
addr_resolv: correctly scope returned memory
*_port_to_display functions take an allocator scope, so the memory they return must be allocated from that scope, which means we must strdup the result of serv_name_lookup. Bug: 10901 Change-Id: I337c8b6f9dfece966964c09023679b3e24648e48 Reviewed-on: https://code.wireshark.org/review/6842 Reviewed-by: Michael Mann <mmann78@netscape.net> Reviewed-by: Evan Huus <eapache@gmail.com>
This commit is contained in:
parent
25f1df4459
commit
0137f9226a
|
@ -2861,7 +2861,7 @@ udp_port_to_display(wmem_allocator_t *allocator, guint port)
|
|||
return wmem_utoa(allocator, port);
|
||||
}
|
||||
|
||||
return serv_name_lookup(port, PT_UDP);
|
||||
return wmem_strdup(allocator, serv_name_lookup(port, PT_UDP));
|
||||
|
||||
} /* udp_port_to_display */
|
||||
|
||||
|
@ -2873,7 +2873,7 @@ dccp_port_to_display(wmem_allocator_t *allocator, guint port)
|
|||
return wmem_utoa(allocator, port);
|
||||
}
|
||||
|
||||
return serv_name_lookup(port, PT_DCCP);
|
||||
return wmem_strdup(allocator, serv_name_lookup(port, PT_DCCP));
|
||||
|
||||
} /* dccp_port_to_display */
|
||||
|
||||
|
@ -2885,7 +2885,7 @@ tcp_port_to_display(wmem_allocator_t *allocator, guint port)
|
|||
return wmem_utoa(allocator, port);
|
||||
}
|
||||
|
||||
return serv_name_lookup(port, PT_TCP);
|
||||
return wmem_strdup(allocator, serv_name_lookup(port, PT_TCP));
|
||||
|
||||
} /* tcp_port_to_display */
|
||||
|
||||
|
@ -2897,7 +2897,7 @@ sctp_port_to_display(wmem_allocator_t *allocator, guint port)
|
|||
return wmem_utoa(allocator, port);
|
||||
}
|
||||
|
||||
return serv_name_lookup(port, PT_SCTP);
|
||||
return wmem_strdup(allocator, serv_name_lookup(port, PT_SCTP));
|
||||
|
||||
} /* sctp_port_to_display */
|
||||
|
||||
|
|
Loading…
Reference in New Issue