stkutil: Make valgrind happy
authorDenis Kenzior <denkenz@gmail.com>
Thu, 2 Feb 2012 15:17:04 +0000 (09:17 -0600)
committerDenis Kenzior <denkenz@gmail.com>
Thu, 2 Feb 2012 15:17:04 +0000 (09:17 -0600)
==29809== Conditional jump or move depends on uninitialised value(s)
==29809==    at 0x4E826C: stk_file_iter_next (stkutil.c:212)
==29809==    by 0x4E8CF8: parse_dataobj_file_list (stkutil.c:635)
==29809==    by 0x4EBA29: parse_dataobj (stkutil.c:2410)
==29809==    by 0x4ECFB5: parse_refresh (stkutil.c:2971)
==29809==    by 0x4EECA3: parse_command_body (stkutil.c:3826)
==29809==    by 0x4EF0DF: stk_command_new_from_pdu (stkutil.c:3948)
==29809==    by 0x4D50DA: ofono_stk_proactive_command_handled_notify
(stk.c:2885)

src/stkutil.c

index 2c7be53..a03e9b7 100644 (file)
@@ -208,11 +208,11 @@ static gboolean stk_file_iter_next(struct stk_file_iter *iter)
        unsigned int i;
        unsigned char last_type;
 
-       /* SIM EFs always start with ROOT MF, 0x3f */
-       if (start[iter->pos] != 0x3f)
+       if (pos + 2 >= max)
                return FALSE;
 
-       if (pos + 2 >= max)
+       /* SIM EFs always start with ROOT MF, 0x3f */
+       if (start[iter->pos] != 0x3f)
                return FALSE;
 
        last_type = 0x3f;