mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 14:25:26 +00:00
netdev-bsd: Use xmemdup0() to simplify netdev_bsd_get_next_hop().
Signed-off-by: Ben Pfaff <blp@nicira.com> CC: Ed Maste <emaste@freebsd.org> CC: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
This commit is contained in:
@@ -1312,12 +1312,9 @@ netdev_bsd_get_next_hop(const struct in_addr *host OVS_UNUSED,
|
||||
if ((i == RTA_IFP) && sa->sa_family == AF_LINK) {
|
||||
const struct sockaddr_dl * const sdl =
|
||||
(const struct sockaddr_dl *)sa;
|
||||
const size_t nlen = sdl->sdl_nlen;
|
||||
char * const kernel_name = xmalloc(nlen + 1);
|
||||
const char *name;
|
||||
char *kernel_name;
|
||||
|
||||
memcpy(kernel_name, sdl->sdl_data, nlen);
|
||||
kernel_name[nlen] = 0;
|
||||
kernel_name = xmemdup0(sdl->sdl_data, sdl->sdl_nlen);
|
||||
name = netdev_bsd_convert_kernel_name_to_ovs_name(kernel_name);
|
||||
if (name == NULL) {
|
||||
ifname = xstrdup(kernel_name);
|
||||
|
Reference in New Issue
Block a user