From f958b9dc4f19c94281b2679b3a6bbb39828beb90 Mon Sep 17 00:00:00 2001 From: Paul Pluzhnikov Date: Wed, 18 Nov 2009 17:16:47 -0800 Subject: [PATCH] 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 --- src/dwarf/Gparser.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/dwarf/Gparser.c b/src/dwarf/Gparser.c index 6fa56ee6..abef447f 100644 --- a/src/dwarf/Gparser.c +++ b/src/dwarf/Gparser.c @@ -784,7 +784,7 @@ HIDDEN int 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 @@ dwarf_find_save_locs (struct dwarf_cursor *c) 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;