Skip to content

Commit c89569b

Browse files
authored
Revert dwarf to incorporate new changes in master
1 parent ba02b9f commit c89569b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/symbols/dwarf/dwarf.hpp

+8-4
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,12 @@ namespace libdwarf {
149149
auto attwrapper = raii_wrap(attr, [] (Dwarf_Attribute attr) { dwarf_dealloc_attribute(attr); });
150150
char* raw_str;
151151
VERIFY(wrap(dwarf_formstring, attr, &raw_str) == DW_DLV_OK);
152-
return std::string(raw_str);
152+
auto strwrapper = raii_wrap(raw_str, [this] (char* str) { dwarf_dealloc(dbg, str, DW_DLA_STRING); });
153+
std::string str = raw_str;
154+
return str;
155+
} else {
156+
return nullopt;
153157
}
154-
return nullopt;
155158
}
156159

157160
optional<Dwarf_Unsigned> get_unsigned_attribute(Dwarf_Half attr_num) const {
@@ -163,8 +166,9 @@ namespace libdwarf {
163166
Dwarf_Unsigned val;
164167
VERIFY(wrap(dwarf_formudata, attr, &val) == DW_DLV_OK);
165168
return val;
169+
} else {
170+
return nullopt;
166171
}
167-
return nullopt;
168172
}
169173

170174
bool has_attr(Dwarf_Half attr_num) const {
@@ -534,4 +538,4 @@ namespace libdwarf {
534538
}
535539
}
536540

537-
#endif
541+
#endif

0 commit comments

Comments
 (0)