[ovs-dev] [PATCH] xcache: Handle null argument for xlate_cache_uninit().

Yifeng Sun pkusunyifeng at gmail.com
Thu Dec 21 18:05:49 UTC 2017


Thanks, looks good to me.

Reviewed-by: Yifeng Sun <pkusunyifeng at gmail.com>


On Wed, Dec 20, 2017 at 7:42 PM, Justin Pettit <jpettit at ovn.org> wrote:

> Most other OVS libraries' delete and uninitialization functions allow a
> null argument, but this one would cause a segfault.
>
> Signed-off-by: Justin Pettit <jpettit at ovn.org>
> ---
>  ofproto/ofproto-dpif-xlate-cache.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/ofproto/ofproto-dpif-xlate-cache.c
> b/ofproto/ofproto-dpif-xlate-cache.c
> index d319d287eadb..24fc769a7a0d 100644
> --- a/ofproto/ofproto-dpif-xlate-cache.c
> +++ b/ofproto/ofproto-dpif-xlate-cache.c
> @@ -279,6 +279,9 @@ xlate_cache_clear(struct xlate_cache *xcache)
>  void
>  xlate_cache_uninit(struct xlate_cache *xcache)
>  {
> +    if (!xcache) {
> +        return;
> +    }
>      xlate_cache_clear(xcache);
>      ofpbuf_uninit(&xcache->entries);
>  }
> --
> 2.7.4
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>


More information about the dev mailing list