songgaoye commented on code in PR #3728:
URL: https://github.com/apache/brpc/pull/3728#discussion_r4545063420
##########
src/brpc/ubshm/ub_ring.cpp:
##########
@@ -1260,8 +1260,9 @@ RETURN_CODE UBRing::ApplyAndMapLocalShm(SHM
*local_trx_shm, const char *local_na
SHM_NAME_PREFIX,
local_name,
CLIENT_SHM_NAME_SUFFIX);
- if (UNLIKELY(result < 0)) {
+ if (UNLIKELY(result < 0 || result >= SHM_MAX_NAME_BUFF_LEN)) {
LOG(ERROR) << "Copy client localTrx shared memory name failed,
local_name=" << local_name << ", ret=" << result;
+ UBRingManager::ReleaseUbrTrxFromMgr(_trx);
return UBRING_ERR;
Review Comment:
`ApplyAndMapLocalShm()` has only one caller, `UbrAllocateLocalShm()`, which
clears _trx immediately when the call fails. Setting it to nullptr again inside
`ApplyAndMapLocalShm()` would be redundant
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]