ms: Fix MS without PTMSI not freed immediatelly

This check (tlli != 0) was added in 2015 in
6d86628e5b6d81afae4ca1f24201ee90bfab1c2a, with the rationale below:

"""
To avoid dangling entries without a TLLI there (which cannnot be
retrieved anyway), the timer in the MS objects is not started after
all TBF have been detached, so that they get deleted immediately in
that case.
"""

The rationale makes sense, but through time the MS class was fixed to
return GSM_RESERVED_TMSI (0xFFFFFFFF) when no TMSI was available.
Hence, the check was wrong, and as a result, free() of MS containing
GSM_RESERVED_TMSI would be delayed over time by release timer.

Related: OS#6002
Change-Id: I7a694a30f8709c00af774846d7c4925cef253a71
diff --git a/src/gprs_ms.c b/src/gprs_ms.c
index 7ecaae4..52ea431 100644
--- a/src/gprs_ms.c
+++ b/src/gprs_ms.c
@@ -229,9 +229,20 @@
 
 static void ms_release_timer_start(struct GprsMs *ms)
 {
+	/* Immediate free():
+	 * Skip delaying free() through release timer if delay is configured to be 0.
+	 * This is useful for synced freed during unit tests.
+	 */
 	if (ms->delay == 0)
 		return;
 
+	/* Immediate free():
+	 * Skip delaying free() through release timer if TMSI is not
+	 * known, since those cannot really be reused.
+	 */
+	if (ms_tlli(ms) == GSM_RESERVED_TMSI)
+		return;
+
 	LOGPMS(ms, DRLCMAC, LOGL_DEBUG, "Schedule MS release in %u secs\n", ms->delay);
 
 	if (!ms->timer.data)
@@ -384,9 +395,7 @@
 	if (!ms->dl_tbf && !ms->ul_tbf) {
 		ms_set_reserved_slots(ms, NULL, 0, 0);
 		ms->first_common_ts = NULL;
-
-		if (ms_tlli(ms) != 0)
-			ms_release_timer_start(ms);
+		ms_release_timer_start(ms);
 	}
 
 	ms_update_status(ms);