Move vagrant stuff to extras/
[vpp.git] / build-root / emacs-lisp / tunnel-c-skel.el
index 6f1096c..a1b1757 100644 (file)
@@ -2,7 +2,7 @@
 
 (require 'skeleton)
 
-(define-skeleton tunnel-c-skel
+(define-skeleton skel-tunnel-c
 "Insert a tunnel cli/api implementation"
 nil
 '(setq encap_stack (skeleton-read "encap_stack (e.g ip4_udp_lisp): "))
@@ -188,7 +188,7 @@ int vnet_" encap_stack "_add_del_tunnel
 
       /* $$$$ use a simple hash if you can ... */
       key_copy = clib_mem_alloc (sizeof (*key_copy));
-      memcpy (key_copy, &key, sizeof (*key_copy));
+      clib_memcpy (key_copy, &key, sizeof (*key_copy));
 
       hash_set_mem (ngm->" encap_stack "_tunnel_by_key, key_copy, 
                     t - ngm->tunnels);
@@ -288,6 +288,7 @@ static clib_error_t *
                                    vlib_cli_command_t * cmd)
 {
   unformat_input_t _line_input, * line_input = &_line_input;
+  clib_error_t *error = 0;
   ip4_address_t src, dst;
   u8 is_add = 1;
   u8 src_set = 0;
@@ -322,13 +323,19 @@ static clib_error_t *
       {
         encap_fib_index = fib_index_from_fib_id (tmp);
         if (encap_fib_index == ~0)
-          return clib_error_return (0, \"nonexistent encap fib id %d\", tmp);
+          {
+            unformat_free (line_input);
+            return clib_error_return (0, \"nonexistent encap fib id %d\", tmp);
+          }
       }
     else if (unformat (line_input, \"decap-vrf-id %d\", &tmp))
       {
         decap_fib_index = fib_index_from_fib_id (tmp);
         if (decap_fib_index == ~0)
-          return clib_error_return (0, \"nonexistent decap fib id %d\", tmp);
+          {
+            unformat_free (line_input);
+            return clib_error_return (0, \"nonexistent decap fib id %d\", tmp);
+          }
       }
     else if (unformat (line_input, \"decap-next %U\", unformat_decap_next, 
                        &decap_next_index))
@@ -346,8 +353,12 @@ static clib_error_t *
      * in the " ENCAP_STACK " header
      */
     else 
-      return clib_error_return (0, \"parse error: '%U'\", 
-                                format_unformat_error, line_input);
+      {
+        error = clib_error_return (0, \"parse error: '%U'\",
+                                   format_unformat_error, line_input);
+        unformat_free (line_input);
+        return error;
+      }
   }
 
   unformat_free (line_input);