diff mbox series

[ovs-dev,08/10] ofproto-dpif: Free leaked 'webster'

Message ID 1568236716-18105-8-git-send-email-pkusunyifeng@gmail.com
State Accepted
Commit 51e6215e7e9e823705c87a973d298ea4d8221204
Headers show
Series [ovs-dev,01/10] raft: Free leaked json data | expand

Commit Message

Yifeng Sun Sept. 11, 2019, 9:18 p.m. UTC
Valgrind reported:

1122: ofproto-dpif - select group with explicit dp_hash selection method

==16884== 64 bytes in 1 blocks are definitely lost in loss record 320 of 346
==16884==    at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==16884==    by 0x532512: xcalloc (util.c:121)
==16884==    by 0x4262B9: group_setup_dp_hash_table (ofproto-dpif.c:4846)
==16884==    by 0x4267CB: group_set_selection_method (ofproto-dpif.c:4938)
==16884==    by 0x4267CB: group_construct (ofproto-dpif.c:4984)
==16884==    by 0x417250: init_group (ofproto.c:7286)
==16884==    by 0x41B4FC: add_group_start (ofproto.c:7316)
==16884==    by 0x42247A: ofproto_group_mod_start (ofproto.c:7589)
==16884==    by 0x4250EC: handle_group_mod (ofproto.c:7744)
==16884==    by 0x4250EC: handle_single_part_openflow (ofproto.c:8428)
==16884==    by 0x4250EC: handle_openflow (ofproto.c:8606)
==16884==    by 0x4579E2: ofconn_run (connmgr.c:1318)
==16884==    by 0x4579E2: connmgr_run (connmgr.c:355)
==16884==    by 0x41E0F5: ofproto_run (ofproto.c:1845)
==16884==    by 0x40BA63: bridge_run__ (bridge.c:2971)
==16884==    by 0x410CF3: bridge_run (bridge.c:3029)
==16884==    by 0x407614: main (ovs-vswitchd.c:127)

This patch fixes it.

Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
---
 ofproto/ofproto-dpif.c | 1 +
 1 file changed, 1 insertion(+)

Comments

William Tu Sept. 17, 2019, 5:37 p.m. UTC | #1
On Wed, Sep 11, 2019 at 02:18:34PM -0700, Yifeng Sun wrote:
> Valgrind reported:
> 
> 1122: ofproto-dpif - select group with explicit dp_hash selection method
> 
> ==16884== 64 bytes in 1 blocks are definitely lost in loss record 320 of 346
> ==16884==    at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==16884==    by 0x532512: xcalloc (util.c:121)
> ==16884==    by 0x4262B9: group_setup_dp_hash_table (ofproto-dpif.c:4846)
> ==16884==    by 0x4267CB: group_set_selection_method (ofproto-dpif.c:4938)
> ==16884==    by 0x4267CB: group_construct (ofproto-dpif.c:4984)
> ==16884==    by 0x417250: init_group (ofproto.c:7286)
> ==16884==    by 0x41B4FC: add_group_start (ofproto.c:7316)
> ==16884==    by 0x42247A: ofproto_group_mod_start (ofproto.c:7589)
> ==16884==    by 0x4250EC: handle_group_mod (ofproto.c:7744)
> ==16884==    by 0x4250EC: handle_single_part_openflow (ofproto.c:8428)
> ==16884==    by 0x4250EC: handle_openflow (ofproto.c:8606)
> ==16884==    by 0x4579E2: ofconn_run (connmgr.c:1318)
> ==16884==    by 0x4579E2: connmgr_run (connmgr.c:355)
> ==16884==    by 0x41E0F5: ofproto_run (ofproto.c:1845)
> ==16884==    by 0x40BA63: bridge_run__ (bridge.c:2971)
> ==16884==    by 0x410CF3: bridge_run (bridge.c:3029)
> ==16884==    by 0x407614: main (ovs-vswitchd.c:127)
> 
> This patch fixes it.
> 
> Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>

LGTM.
Acked-by: William Tu <u9012063@gmail.com>

> ---
>  ofproto/ofproto-dpif.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
> index 46fa1357163b..7bb0f7bdb4f3 100644
> --- a/ofproto/ofproto-dpif.c
> +++ b/ofproto/ofproto-dpif.c
> @@ -4871,6 +4871,7 @@ group_setup_dp_hash_table(struct group_dpif *group, size_t max_hash)
>      if (n_hash > MAX_SELECT_GROUP_HASH_VALUES ||
>          (max_hash != 0 && n_hash > max_hash)) {
>          VLOG_DBG("  Too many hash values required: %"PRIu64, n_hash);
> +        free(webster);
>          return false;
>      }
>  
> -- 
> 2.7.4
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
diff mbox series

Patch

diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 46fa1357163b..7bb0f7bdb4f3 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -4871,6 +4871,7 @@  group_setup_dp_hash_table(struct group_dpif *group, size_t max_hash)
     if (n_hash > MAX_SELECT_GROUP_HASH_VALUES ||
         (max_hash != 0 && n_hash > max_hash)) {
         VLOG_DBG("  Too many hash values required: %"PRIu64, n_hash);
+        free(webster);
         return false;
     }