- u32 * to_next = vlib_frame_vector_args (f);
- u32 bi;
-
- bi = vlib_buffer_add_data (vm, VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX,
- /* buffer to append to */ ~0,
- *contents, vec_len (*contents));
+ u32 * to_next;
+ u32 bi = ~0;
+
+ if (vlib_buffer_add_data (vm, VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX,
+ /* buffer to append to */ &bi,
+ *contents, vec_len (*contents)))
+ {
+ /* complete or partial buffer allocation failure */
+ if (bi != ~0)
+ vlib_buffer_free (vm, &bi, 1);
+ return SRP_ERROR_CONTROL_PACKETS_PROCESSED;
+ }