os: avoid uninitialized offsets in backtrace

When xorg_backtrace calls unw_get_proc_name and an error occurs, offset
might not be set for the current frame.

Initialize offset for each frame so that the offset from another frame
cannot be used inadvertently.

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Jeffrey Smith 2018-02-15 23:47:46 -06:00 committed by Adam Jackson
parent 6f9d29040c
commit 272fa18170
1 changed files with 1 additions and 0 deletions

View File

@ -78,6 +78,7 @@ xorg_backtrace(void)
break;
}
off = 0;
ret = unw_get_proc_name(&cursor, procname, 256, &off);
if (ret && ret != -UNW_ENOMEM) {
if (ret != -UNW_EUNSPEC)