releaserequest踩内存问题修复

Signed-off-by: wangzhan <wangzhan37@huawei.com>
This commit is contained in:
wangzhan 2024-11-21 02:07:36 +00:00 committed by Gitee
parent f9cefb6dd7
commit 2e8d8ee958
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -75,12 +75,12 @@ ReqDataInfo *HRilManager::CreateHRilRequest(int32_t serial, int32_t slotId, int3
std::lock_guard<std::mutex> lockRequest(requestListLock_);
auto iter = requestList_.find(request);
if (iter != requestList_.end()) {
std::list<ReqDataInfo *> &reqDataSet = iter->second;
std::vector<ReqDataInfo *> &reqDataSet = iter->second;
reqDataSet.push_back(requestInfo);
TELEPHONY_LOGD("CreateHRilRequest requestId=%{public}d, list size: %{public}zu", request, reqDataSet.size());
TELEPHONY_LOGD("CreateHRilRequest requestId=%{public}d, vector size: %{public}zu", request, reqDataSet.size());
} else {
TELEPHONY_LOGD("CreateHRilRequest create requestList, requestId=%{public}d", request);
std::list<ReqDataInfo *> reqDataSet;
std::vector<ReqDataInfo *> reqDataSet;
reqDataSet.push_back(requestInfo);
requestList_.emplace(request, reqDataSet);
}
@ -92,7 +92,7 @@ void HRilManager::ReleaseHRilRequest(int32_t request, ReqDataInfo *requestInfo)
std::lock_guard<std::mutex> lockRequest(requestListLock_);
auto iter = requestList_.find(request);
if (iter != requestList_.end()) {
std::list<ReqDataInfo *> &reqDataSet = iter->second;
std::vector<ReqDataInfo *> &reqDataSet = iter->second;
auto it = find(reqDataSet.begin(), reqDataSet.end(), requestInfo);
if (it != reqDataSet.end()) {
if (*it != nullptr) {