mirror_frr/bgpd
root b2a9fc6b23 bgpd: Fix memory leak show ip bgp json
Root Cause: In the function bgp_show_table(), we are creating a
json object and a json array with the same name as “json_paths”.
First it will create a json object variable "json_paths" pointing
to the memory allocated for the json object. Then it will create
a json array for each bap node rn (if rn->info is available) with
the same name as json_paths. Because of this, json_paths which was
pointing to the memory allocated for the json object earlier, now
will be overwritten with the memory allocated for the json array.
As per the existing code, at the end of each iteration loop of bgp
node, it will deallocate the memory used by the json array and
assigned NULL to the variable json_paths. Since we don’t have the
pointer pointing to the memory allocated for json object, will be
not able to de-allocate the memory, which is a memory leak here.

Fix: Removing this json object since it is never getting used in
this function.

Testing:  Reproduced the memory leak with valgrind.
With the fix, memory leak gets resolved and checked with valgrind.

Signed-off-by: Sarita Patra saritap@vmware.com
2018-08-22 16:22:17 -07:00
..
rfapi *: rename zlog_fer -> flog_err 2018-08-14 20:02:05 +00:00
rfp-example *: add missing \n in some help strings 2017-10-24 19:30:30 -02:00
.gitignore *: globally ignore clippy-generated source 2018-03-09 17:52:15 -05:00
BGP4-MIB.txt Initial revision 2002-12-13 20:15:29 +00:00
bgp_advertise.c *: use C99 standard fixed-width integer types 2018-03-27 15:13:34 -04:00
bgp_advertise.h *: use C99 standard fixed-width integer types 2018-03-27 15:13:34 -04:00
bgp_aspath.c *: ALLOC calls cannot fail 2018-08-11 17:14:58 +02:00
bgp_aspath.h *: use C99 standard fixed-width integer types 2018-03-27 15:13:34 -04:00
bgp_attr_evpn.c bgpd: support evpn nd ext community 2018-07-17 13:06:41 -07:00
bgp_attr_evpn.h bgpd: support evpn nd ext community 2018-07-17 13:06:41 -07:00
bgp_attr.c *: rename zlog_fer -> flog_err 2018-08-14 20:02:05 +00:00
bgp_attr.h bgpd: support evpn nd ext community 2018-07-17 13:06:41 -07:00
bgp_bfd.c bgpd/ospf(6)d/pimd: hide BFD commands with timers 2018-08-08 18:25:08 -03:00
bgp_bfd.h *: use C99 standard fixed-width integer types 2018-03-27 15:13:34 -04:00
bgp_btoa.c bgpd: Untrusted argument (Coverity 1399380) 2018-06-19 15:00:25 +02:00
bgp_clist.c bgpd: fix odd memory mgmt in clist strings fn 2018-08-07 19:17:32 +00:00
bgp_clist.h bgpd: clean up clist management logic 2018-04-17 13:58:24 -04:00
bgp_community.c bgpd: Add missing bgp well-known communities 2018-07-29 16:54:16 +02:00
bgp_community.h bgpd: Add missing bgp well-known communities 2018-07-29 16:54:16 +02:00
bgp_damp.c bgpd: avoid indexing with negative integer 2018-04-18 12:16:19 -04:00
bgp_damp.h *: use C99 standard fixed-width integer types 2018-03-27 15:13:34 -04:00
bgp_debug.c bgpd: return value check (Coverity 1472310) 2018-08-13 18:05:42 +02:00
bgp_debug.h bgpd: add pbr error flag for pbr errors 2018-04-30 11:56:23 +02:00
bgp_dump.c *: use C99 standard fixed-width integer types 2018-03-27 15:13:34 -04:00
bgp_dump.h *: reindent 2017-07-17 14:04:07 +02:00
bgp_ecommunity.c bgpd: print evpn nd ext community in route 2018-08-08 21:45:37 -07:00
bgp_ecommunity.h bgpd: support evpn nd ext community 2018-07-17 13:06:41 -07:00
bgp_encap_tlv.c bgpd: Fix off by one error introduced by 8c9cc7bbf6 2017-10-18 18:37:38 -04:00
bgp_encap_tlv.h *: reindent 2017-07-17 14:04:07 +02:00
bgp_encap_types.h *: use C99 standard fixed-width integer types 2018-03-27 15:13:34 -04:00
bgp_errors.c *: rename ferr_ref -> log_ref 2018-08-14 20:02:05 +00:00
bgp_errors.h *: rename ferr_ref -> log_ref 2018-08-14 20:02:05 +00:00
bgp_evpn_private.h Merge pull request #2665 from chiragshah6/evpn_dev 2018-07-24 11:55:08 -04:00
bgp_evpn_vty.c *: rename zlog_fer -> flog_err 2018-08-14 20:02:05 +00:00
bgp_evpn_vty.h bgpd: get rid of afi_header_vty_out() & co. 2017-08-29 08:36:03 +02:00
bgp_evpn.c Merge pull request #2829 from donaldsharp/more_upstream 2018-08-17 11:49:44 -04:00
bgp_evpn.h *: support for evpn type-4 route 2018-05-30 07:48:20 -04:00
bgp_filter.c bgpd: fix clang warning 2017-10-08 23:50:54 +02:00
bgp_filter.h *: reindent 2017-07-17 14:04:07 +02:00
bgp_flowspec_private.h bgpd: support for show bgp ipv4 flowspec 2018-03-30 14:01:05 +02:00
bgp_flowspec_util.c *: rename zlog_fer -> flog_err 2018-08-14 20:02:05 +00:00
bgp_flowspec_util.h bgpd: display more than one FS entre per IP 2018-07-24 12:17:57 +02:00
bgp_flowspec_vty.c bgpd: avoid memory leak in bgp flowspec list, plus usage of bool 2018-08-21 18:30:26 +02:00
bgp_flowspec.c *: fix gcc-8 format-overflow warnings 2018-08-21 21:05:09 +02:00
bgp_flowspec.h bgpd: display more than one FS entre per IP 2018-07-24 12:17:57 +02:00
bgp_fsm.c *: rename ferr_zlog -> flog_err_sys 2018-08-14 20:02:05 +00:00
bgp_fsm.h bgpd: fix bgp_packet.c / bgp_fsm.c organization 2017-11-30 16:18:02 -05:00
bgp_io.c *: rename zlog_fer -> flog_err 2018-08-14 20:02:05 +00:00
bgp_io.h bgpd: update pthreads to use lib changes 2018-01-24 15:30:55 -05:00
bgp_keepalives.c bgpd: zlog_warn to assert for code that must be executed first 2018-08-16 08:24:22 -04:00
bgp_keepalives.h bgpd: update pthreads to use lib changes 2018-01-24 15:30:55 -05:00
bgp_label.c *: rename zlog_fer -> flog_err 2018-08-14 20:02:05 +00:00
bgp_label.h bgpd: Prevent vrf 2 vrf route leaking from going offbox. 2018-04-25 12:41:17 -04:00
bgp_labelpool.c *: rename zlog_fer -> flog_err 2018-08-14 20:02:05 +00:00
bgp_labelpool.h bgpd: dynamic mpls label pool 2018-04-11 23:18:28 -07:00
bgp_lcommunity.c bgpd: Cleanup of bgp daemon code 2018-07-07 22:51:13 +02:00
bgp_lcommunity.h bgpd: Improve JSON support for large communities 2018-05-13 19:37:51 +02:00
bgp_main.c Merge pull request #2834 from dslicenc/import-vrf-fixes 2018-08-17 09:16:26 -04:00
bgp_memory.c *: support for evpn type-4 route 2018-05-30 07:48:20 -04:00
bgp_memory.h *: support for evpn type-4 route 2018-05-30 07:48:20 -04:00
bgp_mpath.c bgpd: null chk (Coverity 1433544 1433543 1433542) 2018-06-18 16:07:43 +02:00
bgp_mpath.h *: use C99 standard fixed-width integer types 2018-03-27 15:13:34 -04:00
bgp_mplsvpn.c Merge pull request #2834 from dslicenc/import-vrf-fixes 2018-08-17 09:16:26 -04:00
bgp_mplsvpn.h bgpd: issues with vrf imports when switchd or networking restarted 2018-08-14 14:33:56 +00:00
bgp_network.c lib: change vrf_is_mapped_on_netns API 2018-08-22 09:19:04 +02:00
bgp_network.h bgpd: server socket is created for all enabled VRF 2018-02-27 11:11:24 +01:00
bgp_nexthop.c bgpd: Cleanup of bgp daemon code 2018-07-07 22:51:13 +02:00
bgp_nexthop.h bgpd: Handle connected routes and IPv6 link-local nexthops for route leaking 2018-04-25 12:39:16 -04:00
bgp_nht.c *: rename zlog_fer -> flog_err 2018-08-14 20:02:05 +00:00
bgp_nht.h bgpd: nexthop tracking with labels for vrf-vpn leaking 2018-04-04 10:00:23 -07:00
bgp_open.c *: rename zlog_fer -> flog_err 2018-08-14 20:02:05 +00:00
bgp_open.h bgpd: Cleanup of bgp daemon code 2018-07-07 22:51:13 +02:00
bgp_packet.c *: rename ferr_zlog -> flog_err_sys 2018-08-14 20:02:05 +00:00
bgp_packet.h *: use C99 standard fixed-width integer types 2018-03-27 15:13:34 -04:00
bgp_pbr.c bgpd: pbr entry log message changed to zlog_debug 2018-08-21 18:30:32 +02:00
bgp_pbr.h bgpd: Cleanup of bgp daemon code 2018-07-07 22:51:13 +02:00
bgp_rd.c bgpd, lib, ospfd, zebra: all_digit moved to frrstr 2018-06-19 17:59:53 +02:00
bgp_rd.h bgpd: Auto RD definitions and encoding 2018-04-25 12:39:16 -04:00
bgp_regex.c *: reindent 2017-07-17 14:04:07 +02:00
bgp_regex.h *: reindent 2017-07-17 14:04:07 +02:00
bgp_route.c bgpd: Fix memory leak show ip bgp json 2018-08-22 16:22:17 -07:00
bgp_route.h bgpd: flowspec pbr entries listed on the bgp information entry 2018-07-24 12:17:57 +02:00
bgp_routemap.c lib, bgpd, ospf6d, ospfd, pimd: Allow finish to cleanup a bit more 2018-08-03 08:22:45 -04:00
bgp_rpki.c bgpd: Fix bgp rpki to match route-map update from PR #2697 2018-08-08 15:08:22 -07:00
bgp_snmp.c bgpd: Implement group-overrides for peer timers 2018-06-14 18:55:30 +02:00
bgp_table.c bgpd: null check (Coverity 1472237) 2018-08-03 16:26:14 +02:00
bgp_table.h lib/bgpd: re-fix bgp_info_extra_free() 2018-08-22 06:32:43 +02:00
bgp_updgrp_adv.c bgpd: variable scope (Coverity 1472229) 2018-08-03 15:47:03 +02:00
bgp_updgrp_packet.c *: rename zlog_fer -> flog_err 2018-08-14 20:02:05 +00:00
bgp_updgrp.c *: rename zlog_fer -> flog_err 2018-08-14 20:02:05 +00:00
bgp_updgrp.h *: use C99 standard fixed-width integer types 2018-03-27 15:13:34 -04:00
bgp_vnc_types.h bgpd: Cleanup of bgp daemon code 2018-07-07 22:51:13 +02:00
bgp_vpn.c Merge pull request #2501 from pacovn/infer_unused1 2018-06-21 15:12:33 -04:00
bgp_vpn.h *: use C99 standard fixed-width integer types 2018-03-27 15:13:34 -04:00
bgp_vty.c bgpd: fix additional issue with bgp route-leak json commit 2018-08-20 21:05:57 +00:00
bgp_vty.h bgpd: add flowspec feature 2018-03-30 14:00:47 +02:00
bgp_zebra.c Merge pull request #2852 from donaldsharp/bgp_clean 2018-08-16 11:30:03 -04:00
bgp_zebra.h bgpd: do not install BGP FS entries, while table range not obtained 2018-05-25 15:49:38 +02:00
bgpd.c Merge pull request #2852 from donaldsharp/bgp_clean 2018-08-16 11:30:03 -04:00
bgpd.conf.sample bgpd: hide "router bgp" commands also under "address-family ipv4 unicast" 2017-05-04 17:06:13 +00:00
bgpd.conf.sample2 Initial revision 2002-12-13 20:15:29 +00:00
bgpd.conf.vnc.sample bgpd: hide "router bgp" commands also under "address-family ipv4 unicast" 2017-05-04 17:06:13 +00:00
bgpd.h bgpd: Cleanup of bgp daemon code 2018-07-07 22:51:13 +02:00
IMPLEMENTATION.txt bgpd: Cleanup of bgp daemon code 2018-07-07 22:51:13 +02:00
Makefile.am bgpd: Cleanup initialization of bgp_errors.c 2018-08-14 20:02:05 +00:00