Get rid of some bogus checks.
Greetings,
Attached patch is rather on the obvious side:
- rs1 can't be NULL since it's assigned on previous line
- rs_new never returns NULL, and if it ever did, we'd crash on memcpy that
preceeds the NULL check.
Tested on Linux/x86_64 with no regressions.
Thanks,
--
Paul Pluzhnikov
diff --git a/src/dwarf/Gparser.c b/src/dwarf/Gparser.c
index 6fa56ee..abef447 100644
--- a/src/dwarf/Gparser.c
+++ b/src/dwarf/Gparser.c
@@ -784,7 +784,7 @@
dwarf_find_save_locs (struct dwarf_cursor *c)
{
dwarf_state_record_t sr;
- dwarf_reg_state_t *rs, *rs1;
+ dwarf_reg_state_t *rs;
struct dwarf_rs_cache *cache;
int ret = 0;
intrmask_t saved_mask;
@@ -809,18 +809,8 @@
if ((ret = create_state_record_for (c, &sr, c->ip)) < 0)
goto out;
- rs1 = &sr.rs_current;
- if (rs1)
- {
- rs = rs_new (cache, c);
- memcpy(rs, rs1, offsetof(struct dwarf_reg_state, ip));
- if (!rs)
- {
- Dprintf ("%s: failed to create unwind rs\n", __FUNCTION__);
- ret = -UNW_EUNSPEC;
- goto out;
- }
- }
+ rs = rs_new (cache, c);
+ memcpy(rs, &sr.rs_current, offsetof(struct dwarf_reg_state, ip));
cache->buckets[c->prev_rs].hint = rs - cache->buckets;
c->hint = rs->hint;