]> git.proxmox.com Git - mirror_frr.git/blobdiff - zebra/zebra_ptm.c
Merge pull request #5793 from ton31337/fix/formatting_show_bgp_summary_failed
[mirror_frr.git] / zebra / zebra_ptm.c
index b48756302a44f4e61c4a90be753433d9115e1904..681b4d1ab8af69c2b7b01b39772b8dd492b83174 100644 (file)
@@ -190,7 +190,7 @@ static int zebra_ptm_flush_messages(struct thread *thread)
                ptm_cb.t_timer = NULL;
                thread_add_timer(zrouter.master, zebra_ptm_connect, NULL,
                                 ptm_cb.reconnect_time, &ptm_cb.t_timer);
-               return (-1);
+               return -1;
        case BUFFER_PENDING:
                ptm_cb.t_write = NULL;
                thread_add_write(zrouter.master, zebra_ptm_flush_messages, NULL,
@@ -200,7 +200,7 @@ static int zebra_ptm_flush_messages(struct thread *thread)
                break;
        }
 
-       return (0);
+       return 0;
 }
 
 static int zebra_ptm_send_message(char *data, int size)
@@ -661,7 +661,7 @@ int zebra_ptm_sock_read(struct thread *thread)
                thread_add_timer(zrouter.master, zebra_ptm_connect, NULL,
                                 ptm_cb.reconnect_time,
                                 &ptm_cb.t_timer);
-               return (-1);
+               return -1;
        }
 
        ptm_cb.t_read = NULL;
@@ -1295,6 +1295,7 @@ static void zebra_ptm_send_bfdd(struct stream *msg)
        }
 
        stream_free(msgc);
+       stream_free(msg);
 }
 
 static void zebra_ptm_send_clients(struct stream *msg)
@@ -1326,6 +1327,7 @@ static void zebra_ptm_send_clients(struct stream *msg)
        }
 
        stream_free(msgc);
+       stream_free(msg);
 }
 
 static int _zebra_ptm_bfd_client_deregister(struct zserv *zs)
@@ -1421,6 +1423,7 @@ static void _zebra_ptm_reroute(struct zserv *zs, struct zebra_vrf *zvrf,
        stream_putw_at(msgc, 0, STREAM_READABLE(msgc));
 
        zebra_ptm_send_bfdd(msgc);
+       msgc = NULL;
 
        /* Registrate process PID for shutdown hook. */
        STREAM_GETL(msg, ppid);
@@ -1429,7 +1432,8 @@ static void _zebra_ptm_reroute(struct zserv *zs, struct zebra_vrf *zvrf,
        return;
 
 stream_failure:
-       stream_free(msgc);
+       if (msgc)
+               stream_free(msgc);
        zlog_err("%s:%d failed to registrate client pid", __FILE__, __LINE__);
 }