Hi nagp,

My intention there was to ‘pass ownership’ of the label stack to the extension. 
The caller, the owner of the rpath, should not then free the label stack. This 
saves the allocation of a new vector and memcpy.

Regards,
neale

From: <[email protected]> on behalf of Nagaprabhanjan Bellari 
<[email protected]>
Date: Monday, 3 July 2017 at 14:38
To: vpp-dev <[email protected]>
Subject: [vpp-dev] A query regarding fib_path_ext_init

Hi,
I have  small query regarding fib_path_ext_init which takes an rpath - of type 
fib_route_path_t, potentially containing a vector of frp_label_stack.
When we add routes, the API handler stacks rpath->frp_label_stack with one or 
more labels, and in fib_path_ext_init, we have:

path_ext->fpe_path = *rpath;
One side effect, IMHO, of copying rpath structure as is will be copying the 
frp_label_stack pointer as well. So, when the caller is done and frees up the 
rpath (including frp_label_stack), then wouldn't 
path_ext->fpe_path.frp_label_stack point to garbage?
Please correct me if I am wrong.
Thanks,
-nagp
_______________________________________________
vpp-dev mailing list
[email protected]
https://lists.fd.io/mailman/listinfo/vpp-dev

Reply via email to