修改getline()内存未释放

Signed-off-by: zhangsaiyang <zhangsaiyang@huawei.com>
This commit is contained in:
zhangsaiyang 2024-03-05 11:18:42 +08:00
parent bba4f7e0ab
commit ec0e2dc4d5

View File

@ -109,12 +109,16 @@ bool Process::CheckMaps(std::string pidPath)
if (CheckSubDir(line)) {
LOGI("Found map in %{public}s", pidPath.c_str());
(void)fclose(file);
free(buf);
buf = nullptr;
return true;
}
}
}
(void)fclose(file);
free(buf);
buf = nullptr;
return false;
}