[sr-dev] git:master:af9deb90: core: safety checks for swich statements with no case branch

Daniel-Constantin Mierla miconda at gmail.com
Thu May 14 13:53:04 CEST 2015


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-05-14T13:33:50+02:00

core: safety checks for swich statements with no case branch

---

Modified: switch.c

---

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

---

diff --git a/switch.c b/switch.c
index b4a6b75..6aeffc2 100644
--- a/switch.c
+++ b/switch.c
@@ -230,7 +230,9 @@ int fix_switch(struct action* t)
 				LM_DBG("default only switch optimized away (BLOCK_T)\n");
 				return 0;
 			}
-			LM_DBG("default only switch with side-effect...\n");
+			LM_CRIT("default only switch with side-effect not expected at this point\n");
+			ret=E_BUG;
+			goto error;
 		}else{
 			LM_CRIT("empty switch not expected at this point\n");
 			ret=E_BUG;
@@ -545,7 +547,9 @@ static int fix_match(struct action* t)
 				LM_DBG("default only switch optimized away (BLOCK_T)\n");
 				return 0;
 			}
-			LM_DBG("default only switch with side-effect...\n");
+			LM_CRIT("default only switch with side-effect not expected at this point\n");
+			ret=E_BUG;
+			goto error;
 		}else{
 			LM_CRIT("empty switch not expected at this point\n");
 			ret=E_BUG;




More information about the sr-dev mailing list