已开启
update: 更新文件 av_virtual_memory.cpp #2747
update: 更新文件 av_virtual_memory.cpp #2747
已开启
cgxcgxcgx创建于 8月22日
共 1 个文件变更+2-1
@@ -13,6 +13,7 @@
13 * limitations under the License.13 * limitations under the License.
14 */14 */
15 15 
16+#include <climits>
16#include "av_virtual_memory.h"17#include "av_virtual_memory.h"
17#include "av_virtual_allocator.h"18#include "av_virtual_allocator.h"
18#include "avbuffer_utils.h"19#include "avbuffer_utils.h"
@@ -38,7 +39,7 @@ AVVirtualAllocator::AVVirtualAllocator(){};
38 39 
39void *AVVirtualAllocator::Alloc(int32_t capacity)40void *AVVirtualAllocator::Alloc(int32_t capacity)
40{41{
41- uint8_t *ptr = new uint8_t[capacity];42+ uint8_t *ptr = new(std::nothrow) uint8_t[capacity];
42 FALSE_RETURN_V_MSG_E(ptr != nullptr, nullptr, "Alloc memory failed, no memory");43 FALSE_RETURN_V_MSG_E(ptr != nullptr, nullptr, "Alloc memory failed, no memory");
43 44 
44 return static_cast<void *>(ptr);45 return static_cast<void *>(ptr);