[sr-dev] git:master:2111a605: path: handle return code when getting the values for cfg parameters

Daniel-Constantin Mierla miconda at gmail.com
Wed Jul 19 11:04:58 CEST 2017


Module: kamailio
Branch: master
Commit: 2111a605760f998cc94329713f1d16cfbe0294bc
URL: https://github.com/kamailio/kamailio/commit/2111a605760f998cc94329713f1d16cfbe0294bc

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-07-19T11:03:49+02:00

path: handle return code when getting the values for cfg parameters

---

Modified: src/modules/path/path.c

---

Diff:  https://github.com/kamailio/kamailio/commit/2111a605760f998cc94329713f1d16cfbe0294bc.diff
Patch: https://github.com/kamailio/kamailio/commit/2111a605760f998cc94329713f1d16cfbe0294bc.patch

---

diff --git a/src/modules/path/path.c b/src/modules/path/path.c
index 274e6cfc7c..f916e2abff 100644
--- a/src/modules/path/path.c
+++ b/src/modules/path/path.c
@@ -244,10 +244,18 @@ int add_path_usr(struct sip_msg* _msg, char* _usr, char* _parms)
 	str user = {0,0};
 	str parms = {0,0};
 
-	if (_usr)
-		get_str_fparam(&user, _msg, (fparam_t *) _usr);
-	if (_parms)
-		get_str_fparam(&parms, _msg, (fparam_t *) _parms);
+	if (_usr) {
+		if(get_str_fparam(&user, _msg, (fparam_t *) _usr)<0) {
+			LM_ERR("failed to get user value\n");
+			return -1;
+		}
+	}
+	if (_parms) {
+		if(get_str_fparam(&parms, _msg, (fparam_t *) _parms)<0) {
+			LM_ERR("failed to get params value\n");
+			return -1;
+		}
+	}
 
 	return prepend_path(_msg, &user, PATH_PARAM_NONE, &parms);
 }
@@ -298,10 +306,18 @@ int add_path_received_usr(struct sip_msg* _msg, char* _usr, char* _parms)
 	str user = {0,0};
 	str parms = {0,0};
 
-	if (_usr)
-		get_str_fparam(&user, _msg, (fparam_t *) _usr);
-	if (_parms)
-		get_str_fparam(&parms, _msg, (fparam_t *) _parms);
+	if (_usr) {
+		if(get_str_fparam(&user, _msg, (fparam_t *) _usr)<0) {
+			LM_ERR("failed to get user value\n");
+			return -1;
+		}
+	}
+	if (_parms) {
+		if(get_str_fparam(&parms, _msg, (fparam_t *) _parms)<0) {
+			LM_ERR("failed to get params value\n");
+			return -1;
+		}
+	}
 
 	return prepend_path(_msg, &user, PATH_PARAM_RECEIVED, &parms);
 }




More information about the sr-dev mailing list