From 3b8b1855038afde448993e5a56955e9b7a4d99c2 Mon Sep 17 00:00:00 2001 From: ajs Date: Sat, 29 Jan 2005 18:19:13 +0000 Subject: 2005-01-29 Andrew J. Schorr * buffer.h: Fix comment on buffer_getstr to reflect that it now uses XMALLOC. * buffer.c: (buffer_getstr) Use XMALLOC(MTYPE_TMP) instead of malloc. * filter.c: (access_list_remark,ipv6_access_list_remark) Use argv_concat instead of buffer_getstr. * if.c: (interface_desc) Use argv_concat instead of buffer_getstr. * plist.c: (ip_prefix_list_description,ipv6_prefix_list_description) Use argv_concat instead of buffer_getstr. * bgp_filter.c: (ip_as_path,no_ip_as_path) Use argv_concat instead of buffer_getstr. * bgp_route.c: (bgp_show_regexp) Fix memory leak: need to free string returned by buffer_getstr. (bgp_show_community) Must use XFREE instead of free on string returned by buffer_getstr. * bgp_routemap.c: (set_community) Must use XFREE instead of free on string returned by buffer_getstr. * bgp_vty.c: (neighbor_description) Use argv_concat instead of buffer_getstr. --- bgpd/bgp_vty.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'bgpd/bgp_vty.c') diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 027b8ca9..5968f68c 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -28,6 +28,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "stream.h" #include "thread.h" #include "log.h" +#include "memory.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_attr.h" @@ -2576,9 +2577,7 @@ DEFUN (neighbor_description, "Up to 80 characters describing this neighbor\n") { struct peer *peer; - struct buffer *b; char *str; - int i; peer = peer_and_group_lookup_vty (vty, argv[0]); if (! peer) @@ -2587,21 +2586,11 @@ DEFUN (neighbor_description, if (argc == 1) return CMD_SUCCESS; - /* Make string from buffer. This function should be provided by - buffer.c. */ - b = buffer_new (1024); - for (i = 1; i < argc; i++) - { - buffer_putstr (b, argv[i]); - buffer_putc (b, ' '); - } - buffer_putc (b, '\0'); - str = buffer_getstr (b); - buffer_free (b); + str = argv_concat(argv, argc, 1); peer_description_set (peer, str); - free (str); + XFREE (MTYPE_TMP, str); return CMD_SUCCESS; } -- cgit v1.2.1