2
0

AddressSanitizer report stack-use-after-scope

Fix the stack-use-after-scope error reported by the AddressSanitizer.

Bug: SWDEV-291913
Change-Id: I0ffd71af8679b8bff6c363096fafe75dffcf329e


[ROCm/rocm_smi_lib commit: 8c60dbebaa]
Este cometimento está contido em:
Bill(Shuzhou) Liu
2021-06-25 13:31:03 -04:00
ascendente 9abb288ace
cometimento a4dba3ba7e
+2 -1
Ver ficheiro
@@ -422,7 +422,8 @@ static int get_supported_sensors(std::string dir_path, std::string fn_reg_ex,
if (std::regex_search(fn, match, re)) {
assert(match.size() == 2); // 1 for whole match + 1 for sub-match
errno = 0;
mon_val = strtoul(match.str(1).c_str(), &endptr, 10);
std::string val_str(match.str(1));
mon_val = strtoul(val_str.c_str(), &endptr, 10);
assert(errno == 0);
assert(*endptr == '\0');
if (errno) {