Skip to content

Commit 4a82f95

Browse files
committed
Add check for calloc
1 parent d229d72 commit 4a82f95

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/export_cache.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,9 @@ void export_cache(py::module& m) {
292292
if (obj == LHD_HIT_MARKER) {
293293
cache_obj_t* dummy_obj =
294294
static_cast<cache_obj_t*>(calloc(1, sizeof(cache_obj_t)));
295+
if (dummy_obj == nullptr) {
296+
throw std::bad_alloc();
297+
}
295298
dummy_obj->obj_id = req.obj_id;
296299
dummy_obj->obj_size = req.obj_size;
297300
return py::cast(

0 commit comments

Comments
 (0)