]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
bridge: print_vlan: add missing check for json instance
authorRoopa Prabhu <roopa@cumulusnetworks.com>
Wed, 3 Aug 2016 06:07:05 +0000 (23:07 -0700)
committerStephen Hemminger <shemming@brocade.com>
Mon, 8 Aug 2016 15:44:16 +0000 (08:44 -0700)
Also initialize vlan_flags

Fixes: d82a49ce85f0 ("bridge: add json support for bridge vlan show")
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
bridge/vlan.c

index c2e635fce61daa7b3d783b9b08f2e434c7ff820a..d3505b59b6fc7ac7c9aa703f8ff4091a5683fbca 100644 (file)
@@ -188,7 +188,7 @@ static int print_vlan(const struct sockaddr_nl *who,
        struct ifinfomsg *ifm = NLMSG_DATA(n);
        int len = n->nlmsg_len;
        struct rtattr *tb[IFLA_MAX+1];
-       bool vlan_flags;
+       bool vlan_flags = false;
 
        if (n->nlmsg_type != RTM_NEWLINK) {
                fprintf(stderr, "Not RTM_NEWLINK: %08x %08x %08x\n",
@@ -276,7 +276,7 @@ static int print_vlan(const struct sockaddr_nl *who,
                                        fprintf(fp, " Egress Untagged");
                                }
                        }
-                       if (vlan_flags) {
+                       if (jw_global && vlan_flags) {
                                jsonw_end_array(jw_global);
                                vlan_flags = false;
                        }