simutil: Add checks for NULL
authorAki Niemi <aki.niemi@nokia.com>
Wed, 2 Feb 2011 07:49:17 +0000 (09:49 +0200)
committerAki Niemi <aki.niemi@nokia.com>
Wed, 2 Feb 2011 09:03:21 +0000 (11:03 +0200)
src/simutil.c

index ac9dd2f..9298886 100644 (file)
@@ -975,6 +975,9 @@ gboolean sim_spdi_lookup(struct sim_spdi *spdi,
 
 void sim_spdi_free(struct sim_spdi *spdi)
 {
+       if (spdi == NULL)
+               return;
+
        g_slist_foreach(spdi->operators, (GFunc)g_free, NULL);
        g_slist_free(spdi->operators);
        g_free(spdi);
@@ -982,6 +985,9 @@ void sim_spdi_free(struct sim_spdi *spdi)
 
 static void pnn_operator_free(struct sim_eons_operator_info *oper)
 {
+       if (oper == NULL)
+               return;
+
        g_free(oper->info);
        g_free(oper->shortname);
        g_free(oper->longname);
@@ -1072,6 +1078,9 @@ void sim_eons_free(struct sim_eons *eons)
 {
        int i;
 
+       if (eons == NULL)
+               return;
+
        for (i = 0; i < eons->pnn_max; i++)
                pnn_operator_free(eons->pnn_list + i);