Fix some minor issues found via static analysis 13/258513/1 tizen
authorMichal Bloch <m.bloch@samsung.com>
Wed, 19 May 2021 11:11:51 +0000 (13:11 +0200)
committerMichal Bloch <m.bloch@samsung.com>
Wed, 19 May 2021 11:11:51 +0000 (13:11 +0200)
Change-Id: Id42676afafc1da2f8c37f315f0047c8d664475ea
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
include/tdep-arm/libunwind_i.h
src/mi/Gdyn-remote.c

index 2602f41..0084054 100644 (file)
@@ -50,8 +50,8 @@ typedef struct
   {
     uint32_t virtual_address;
     int32_t frame_type     : 3;  /* unw_tdep_frame_type_t classification */
-    int32_t last_frame     : 1;  /* non-zero if last frame in chain */
-    int32_t cfa_reg_sp     : 1;  /* cfa dwarf base register is sp vs. r7 */
+    uint32_t last_frame    : 1;  /* non-zero if last frame in chain */
+    uint32_t cfa_reg_sp    : 1;  /* cfa dwarf base register is sp vs. r7 */
     int32_t cfa_reg_offset : 30; /* cfa is at this offset from base register value */
     int32_t r7_cfa_offset  : 30; /* r7 saved at this offset from cfa (-1 = not saved) */
     int32_t lr_cfa_offset  : 30; /* lr saved at this offset from cfa (-1 = not saved) */
index 40a5ad8..702c265 100644 (file)
@@ -228,7 +228,7 @@ unwi_dyn_remote_find_proc_info (unw_addr_space_t as, unw_word_t ip,
 
       if (fetchw (as, a, &addr, &gen1, arg) < 0
           || fetchw (as, a, &addr, &next_addr, arg) < 0)
-        return ret;
+        goto fail;
 
       for (addr = next_addr; addr != 0; addr = next_addr)
         {
@@ -245,6 +245,10 @@ unwi_dyn_remote_find_proc_info (unw_addr_space_t as, unw_word_t ip,
             {
               if (!di)
                 di = calloc (1, sizeof (*di));
+              if (!di) {
+                ret = -UNW_ENOMEM;
+                goto fail;
+              }
 
               di->start_ip = start_ip;
               di->end_ip = end_ip;
@@ -275,10 +279,11 @@ unwi_dyn_remote_find_proc_info (unw_addr_space_t as, unw_word_t ip,
     recheck:
       addr = dyn_list_addr;
       if (fetchw (as, a, &addr, &gen2, arg) < 0)
-        return ret;
+        goto fail;
     }
   while (gen1 != gen2);
 
+fail:
   if (ret < 0 && di)
     free (di);