[Encoder] add error handling in memory allocation failed case for multi-threading
Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 4 files). Show all
Unified · Split
| @@ -2290,8 +2290,7 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 2289 unmodified lines | ||
| 2290 | 2290 | if ((*ppCtx)->pMemAlign != NULL) { |
| 2291 | 2291 | WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_INFO, "FreeMemorySvc(), verify memory usage (%d bytes) after free..", |
| 2292 | 2292 | (*ppCtx)->pMemAlign->WelsGetMemoryUsage()); |
| 2293 | − delete (*ppCtx)->pMemAlign; | |
| 2294 | − (*ppCtx)->pMemAlign = NULL; | |
| 2293 | + WELS_DELETE_OP((*ppCtx)->pMemAlign); | |
| 2295 | 2294 | } |
| 2296 | 2295 | |
| 2297 | 2296 | free (*ppCtx); |
| @@ -2479,8 +2478,7 @@ void WelsUninitEncoderExt (sWelsEncCtx** ppCtx) { · 181 unmodified lines | ||
| 2479 | 2478 | |
| 2480 | 2479 | if ((*ppCtx)->pVpp) { |
| 2481 | 2480 | (*ppCtx)->pVpp->FreeSpatialPictures (*ppCtx); |
| 2482 | − delete (*ppCtx)->pVpp; | |
| 2483 | − (*ppCtx)->pVpp = NULL; | |
| 2481 | + WELS_DELETE_OP((*ppCtx)->pVpp); | |
| 2484 | 2482 | } |
| 2485 | 2483 | FreeMemorySvc (ppCtx); |
| 2486 | 2484 | *ppCtx = NULL; |