1.1 --- a/libfsserver/lib/pipes/pipe_paging.cc Tue May 18 00:55:20 2021 +0200
1.2 +++ b/libfsserver/lib/pipes/pipe_paging.cc Tue May 18 23:58:19 2021 +0200
1.3 @@ -95,6 +95,18 @@
1.4 return _endpoints < 2;
1.5 }
1.6
1.7 +void PipePaging::discard_region(unsigned int i)
1.8 +{
1.9 + PageMapper *mapper = _regions[i];
1.10 +
1.11 + if (mapper != NULL)
1.12 + {
1.13 + mapper->detach();
1.14 + _regions[i] = NULL;
1.15 + delete mapper;
1.16 + }
1.17 +}
1.18 +
1.19 /* Detach one endpoint. */
1.20
1.21 void PipePaging::detach()
1.22 @@ -112,16 +124,7 @@
1.23 /* Discard all regions from the pipe. */
1.24
1.25 for (unsigned int i = 0; i < 2; i++)
1.26 - {
1.27 - PageMapper *mapper = _regions[i];
1.28 -
1.29 - if (mapper != NULL)
1.30 - {
1.31 - mapper->detach();
1.32 - _regions[i] = NULL;
1.33 - delete mapper;
1.34 - }
1.35 - }
1.36 + discard_region(i);
1.37
1.38 /* Release IRQs. */
1.39
1.40 @@ -195,14 +198,7 @@
1.41
1.42 /* Detach and discard the current page mapper. */
1.43
1.44 - PageMapper *mapper = _regions[_reading];
1.45 -
1.46 - if (mapper != NULL)
1.47 - {
1.48 - mapper->detach();
1.49 - _regions[_reading] = NULL;
1.50 - delete mapper;
1.51 - }
1.52 + discard_region(_reading);
1.53
1.54 /* Select the next region. */
1.55