From 80067ec2623e0d6b18006bb3fad554a3526a9d48 Mon Sep 17 00:00:00 2001 From: wumiao Date: Thu, 17 Oct 2024 16:14:12 -0400 Subject: [PATCH] Fix a panic by gnmi subscribe with invalid xpath --- gnmi_server/client_subscribe.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gnmi_server/client_subscribe.go b/gnmi_server/client_subscribe.go index bf791e79..2207bd30 100644 --- a/gnmi_server/client_subscribe.go +++ b/gnmi_server/client_subscribe.go @@ -179,12 +179,13 @@ func (c *Client) Run(stream gnmipb.GNMI_SubscribeServer) (err error) { /* For any other target or no target create new Transl Client. */ dc, err = sdc.NewTranslClient(prefix, paths, ctx, extensions, sdc.TranslWildcardOption{}) } - defer dc.Close() if err != nil { return grpc.Errorf(codes.NotFound, "%v", err) } + defer dc.Close() + switch mode { case gnmipb.SubscriptionList_STREAM: c.stop = make(chan struct{}, 1)