From: Victor Seva <linuxmaniac@torreviejawireless.org>
Date: Tue, 21 Apr 2020 13:03:16 +0200
Subject: [PATCH] pv: fixes for KEMI pvx.xavp_getd

---
 src/modules/pv/pv.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/modules/pv/pv.c b/src/modules/pv/pv.c
index c53ea16..b427667 100644
--- a/src/modules/pv/pv.c
+++ b/src/modules/pv/pv.c
@@ -1223,7 +1223,7 @@ sr_kemi_dict_item_t* ki_xavp_dict(sr_xavp_t *xavp);
 /**
  * SR_KEMIP_ARRAY with values of xavp=>name
  */
-sr_kemi_dict_item_t* ki_xavp_dict_name(sr_xavp_t *xavp, str name)
+sr_kemi_dict_item_t* ki_xavp_dict_name(sr_xavp_t *xavp, str *name)
 {
 	sr_kemi_dict_item_t *ini = NULL;
 	sr_kemi_dict_item_t *val;
@@ -1237,7 +1237,7 @@ sr_kemi_dict_item_t* ki_xavp_dict_name(sr_xavp_t *xavp, str name)
 	}
 	memset(ini, 0, sizeof(sr_kemi_xval_t));
 	ini->vtype = SR_KEMIP_ARRAY;
-	while(avp!=NULL&&!STR_EQ(avp->name,name))
+	while(avp!=NULL&&!STR_EQ(avp->name,*name))
 	{
 		avp = avp->next;
 	}
@@ -1288,8 +1288,8 @@ sr_kemi_dict_item_t* ki_xavp_dict_name(sr_xavp_t *xavp, str name)
 			last->next = val;
 		} else {
 			ini->v.dict = val;
-			last = val;
 		}
+		last = val;
 		avp = xavp_get_next(avp);
 	}
 	return ini;
@@ -1329,13 +1329,13 @@ sr_kemi_dict_item_t* ki_xavp_dict(sr_xavp_t *xavp) {
 			val->vtype = SR_KEMIP_DICT;
 			val->name.s = keys->s.s;
 			val->name.len = keys->s.len;
-			val->v.dict = ki_xavp_dict_name(avp, keys->s);
+			val->v.dict = ki_xavp_dict_name(avp, &keys->s);
 			if(last) {
 				last->next = val;
 			} else {
 				ini = val;
-				last = ini;
 			}
+			last = val;
 			k = keys;
 			keys = keys->next;
 			pkg_free(k);
