SolidWallOfCode commented on a change in pull request #7028:
URL: https://github.com/apache/trafficserver/pull/7028#discussion_r459525926
##########
File path: iocore/cache/Cache.cc
##########
@@ -2596,21 +2596,26 @@ cplist_update()
if (nullptr == config_vol->cachep) {
// Find out if this is a forced volume assigned exclusively to a span
which was cleared (hence not referenced in cp_list).
// Note: non-exclusive cleared spans are not handled here, only the
"exclusive"
+ bool forced_volume = false;
for (int d_no = 0; d_no < gndisks; d_no++) {
if (gdisks[d_no]->forced_volume_num == config_vol->number) {
- CacheVol *new_cp = new CacheVol();
- if (nullptr != new_cp) {
- new_cp->disk_vols = (DiskVol **)ats_malloc(gndisks *
sizeof(DiskVol *));
- if (nullptr != new_cp->disk_vols) {
- memset(new_cp->disk_vols, 0, gndisks * sizeof(DiskVol *));
- new_cp->vol_number = config_vol->number;
- new_cp->scheme = config_vol->scheme;
- config_vol->cachep = new_cp;
- fillExclusiveDisks(config_vol->cachep);
- cp_list.enqueue(new_cp);
- } else {
- delete new_cp;
- }
+ forced_volume = true;
+ }
+ }
+
+ if (forced_volume) {
+ CacheVol *new_cp = new CacheVol();
+ if (nullptr != new_cp) {
Review comment:
I've always wondered about this - if that's `nullptr` it would probably
be better to just crash on the dereference. OPRS.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]