2005-01-29 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* 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.
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 027b8ca..5968f68 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -28,6 +28,7 @@
#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 @@
"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 @@
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;
}