Sure, will send out a v2.
Thanks, Shashank ________________________________ From: Alin Serdean <aserd...@cloudbasesolutions.com> Sent: Friday, May 19, 2017 2:51:27 PM To: Shashank Ram; d...@openvswitch.org Subject: RE: [ovs-dev] [PATCH] lib Windows: Use xmalloc instead of malloc Thanks for the patch! Xmalloc also check if the allocation was successful. Mind also removing the checks for null afterwards? Thanks, Alin. > -----Original Message----- > From: ovs-dev-boun...@openvswitch.org [mailto:ovs-dev- > boun...@openvswitch.org] On Behalf Of Shashank Ram > Sent: Saturday, May 20, 2017 12:39 AM > To: d...@openvswitch.org > Subject: [ovs-dev] [PATCH] lib Windows: Use xmalloc instead of malloc > > xmalloc checks if the size is valid before allocating memory. > > Signed-off-by: Shashank Ram <r...@vmware.com> > --- > lib/netdev-windows.c | 4 ++-- > lib/wmi.c | 4 ++-- > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/lib/netdev-windows.c b/lib/netdev-windows.c index > 375cb32..b4b39e9 100644 > --- a/lib/netdev-windows.c > +++ b/lib/netdev-windows.c > @@ -394,7 +394,7 @@ netdev_windows_arp_lookup(const struct netdev > *netdev, > return ENXIO; > } > > - arp_table = (MIB_IPNETTABLE *) malloc(buffer_length); > + arp_table = (MIB_IPNETTABLE *) xmalloc(buffer_length); > > if (arp_table == NULL) { > VLOG_ERR("Could not allocate memory for all the interfaces"); @@ - > 443,7 +443,7 @@ netdev_windows_get_next_hop(const struct in_addr > *host, > return ENXIO; > } [Alin Serdean] remove if > > - all_addr = (IP_ADAPTER_ADDRESSES *) malloc(buffer_length); > + all_addr = (IP_ADAPTER_ADDRESSES *) xmalloc(buffer_length); > > if (all_addr == NULL) { > VLOG_ERR("Could not allocate memory for all the interfaces"); [Alin Serdean] remove if diff --git > a/lib/wmi.c b/lib/wmi.c index dba8022..b560a7e 100644 > --- a/lib/wmi.c > +++ b/lib/wmi.c > @@ -406,7 +406,7 @@ delete_wmi_port(char *name) > wchar_t internal_port_query[WMI_QUERY_COUNT] = L"SELECT * from " > L"Msvm_EthernetPortAllocationSettingData WHERE ElementName = \"" > ; > > - wide_name = malloc((strlen(name) + 1) * sizeof(wchar_t)); > + wide_name = xmalloc((strlen(name) + 1) * sizeof(wchar_t)); > if (wide_name == NULL) { > VLOG_WARN("Could not allocate memory for wide string"); > retval = false; [Alin Serdean] remove if > @@ -693,7 +693,7 @@ create_wmi_port(char *name) { > wchar_t internal_port_query[WMI_QUERY_COUNT] = L"SELECT * FROM " > L"Msvm_InternalEthernetPort WHERE ElementName = \""; > > - wide_name = malloc((strlen(name) + 1) * sizeof(wchar_t)); > + wide_name = xmalloc((strlen(name) + 1) * sizeof(wchar_t)); > if (wide_name == NULL) { > VLOG_WARN("Could not allocate memory for wide string"); > retval = false; [Alin Serdean] remove if > -- > 2.9.3.windows.2 > > _______________________________________________ > dev mailing list > d...@openvswitch.org > https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openvswitch.org_mailman_listinfo_ovs-2Ddev&d=DwIFAg&c=uilaK90D4TOVoH58JNXRgQ&r=6OuVHk-mnufSWzkKa74UkQ&m=mfkoaz1JMXYW8oHB1F7xAajrZhLV6Z-IlDRkryqwb5o&s=taYazsV3M9fsNqeoxrywyjAN0pOH7LQvcYnJV6G58_Y&e= _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev