Acked-by: Sairam Venugopal <vsai...@vmware.com>
On 5/19/17, 2:38 PM, "ovs-dev-boun...@openvswitch.org on behalf of Shashank Ram" <ovs-dev-boun...@openvswitch.org on behalf of r...@vmware.com> wrote: >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; > } > >- 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"); >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; >@@ -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; >-- >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=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=Z6vowHUOjP5ysP_g372c49Nqc1vEKqHKNBkR5Q5Z7uo&m=A_SrOn7pygG6mPCwmqq6YGTrmTn8yCfvuSryqv25tqY&s=x4TwpFwUmcevmXKYYFaWo8XUR-0DNGsADZbfW6I_DU4&e= > _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev