fix telephony daemon crash issue
authorCaiwen Zhang <caiwen.zhang@intel.com>
Wed, 3 Jul 2013 20:36:47 +0000 (04:36 +0800)
committerCaiwen Zhang <caiwen.zhang@intel.com>
Wed, 3 Jul 2013 20:36:47 +0000 (04:36 +0800)
if the net_name_type isn't 0,5,6 "net_name" isn't assigned new value
but it is freed again. Reset it to NULL after it is freed.

type 3(type 1 and 0 are ignored) network name may be returned instead of type 5
type 4(type 2 and 0 are ignored) network name may be returned instead of type 6

Change-Id: Id0fa47274d7415e5788a17be03ffe6d2ab1d0d47

src/s_network.c

index 68da560..8857074 100644 (file)
@@ -881,6 +881,7 @@ static void on_response_get_nitz_name(TcorePending *p, int data_len, const void
                                                break;
 
                                        case 5: /* Short NITZ name*/
+                                       case 3: /* Short Network Name (CPHS) */
                                                if ((pResp = tcore_at_tok_nth(tokens, 1))) {
                                                        if (strlen(pResp) > 0) {
                                                                net_name = tcore_at_tok_extract((const char *)pResp);
@@ -891,6 +892,7 @@ static void on_response_get_nitz_name(TcorePending *p, int data_len, const void
                                                break;
 
                                        case 6: /* Full NITZ name */
+                                       case 4: /* Long Network Name (CPHS) */
                                                if ((pResp = tcore_at_tok_nth(tokens, 1))) {
                                                        if (strlen(pResp) > 0) {
                                                                net_name = tcore_at_tok_extract((const char *)pResp);
@@ -905,6 +907,7 @@ static void on_response_get_nitz_name(TcorePending *p, int data_len, const void
                                        }
 
                                        g_free(net_name);
+                                       net_name = NULL;
                                }
 
                                tcore_at_tok_free(tokens);