[ovs-dev] ofproto-dpif-sflow: Use xzalloc() instead of calloc() to allocate memory.
diff mbox

Message ID 1442417733-12498-1-git-send-email-blp@nicira.com
State Accepted
Headers show

Commit Message

Ben Pfaff Sept. 16, 2015, 3:35 p.m. UTC
Memory allocation shouldn't be allowed to fail.

CC: Neil McKee <neil.mckee@inmon.com>
Reported-by: neeraj mehta <mehtaneeraj07@gmail.com>
Reported-at: http://openvswitch.org/pipermail/discuss/2015-September/018776.html
Signed-off-by: Ben Pfaff <blp@nicira.com>
---
 AUTHORS                      | 1 +
 ofproto/ofproto-dpif-sflow.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

Comments

Russell Bryant Sept. 16, 2015, 4:18 p.m. UTC | #1
On 09/16/2015 11:35 AM, Ben Pfaff wrote:
> Memory allocation shouldn't be allowed to fail.
> 
> CC: Neil McKee <neil.mckee@inmon.com>
> Reported-by: neeraj mehta <mehtaneeraj07@gmail.com>
> Reported-at: http://openvswitch.org/pipermail/discuss/2015-September/018776.html
> Signed-off-by: Ben Pfaff <blp@nicira.com>

Acked-by: Russell Bryant <rbryant@redhat.com>
Ben Pfaff Sept. 16, 2015, 5:13 p.m. UTC | #2
On Wed, Sep 16, 2015 at 12:18:51PM -0400, Russell Bryant wrote:
> On 09/16/2015 11:35 AM, Ben Pfaff wrote:
> > Memory allocation shouldn't be allowed to fail.
> > 
> > CC: Neil McKee <neil.mckee@inmon.com>
> > Reported-by: neeraj mehta <mehtaneeraj07@gmail.com>
> > Reported-at: http://openvswitch.org/pipermail/discuss/2015-September/018776.html
> > Signed-off-by: Ben Pfaff <blp@nicira.com>
> 
> Acked-by: Russell Bryant <rbryant@redhat.com>

Thanks, applied to master, branch-2.4, and branch-2.3.

Patch
diff mbox

diff --git a/AUTHORS b/AUTHORS
index a7f40bb..b348942 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -385,6 +385,7 @@  ankur dwivedi           ankurengg2003@gmail.com
 chen zhang              3zhangchen9211@gmail.com
 kk yap                  yapkke@stanford.edu
 likunyun                kunyunli@hotmail.com
+neeraj mehta            mehtaneeraj07@gmail.com
 rahim entezari          rahim.entezari@gmail.com
 俊 赵                    zhaojun12@outlook.com
 冯全树(Crab)            fqs888@126.com
diff --git a/ofproto/ofproto-dpif-sflow.c b/ofproto/ofproto-dpif-sflow.c
index 260c01b..d479997 100644
--- a/ofproto/ofproto-dpif-sflow.c
+++ b/ofproto/ofproto-dpif-sflow.c
@@ -136,7 +136,7 @@  static void *
 sflow_agent_alloc_cb(void *magic OVS_UNUSED, SFLAgent *agent OVS_UNUSED,
                      size_t bytes)
 {
-    return calloc(1, bytes);
+    return xzalloc(bytes);
 }
 
 /* sFlow library callback to free memory. */