@@ -1088,7 +1088,8 @@ __mos_context_restore_xe(struct mos_bufmgr *bufmgr,
10881088 ret = mos_query_engines_count_xe (bufmgr , & nengine );
10891089 MOS_DRM_CHK_STATUS_MESSAGE_RETURN (ret ,
10901090 "query engine count of restore failed, return error(%d)" , ret )
1091- struct drm_xe_engine_class_instance engine_map [nengine ];
1091+ struct drm_xe_engine_class_instance * engine_map = nullptr ;
1092+ engine_map = (struct drm_xe_engine_class_instance * )MOS_AllocAndZeroMemory (nengine * sizeof (struct drm_xe_engine_class_instance ));
10921093 ret = mos_query_engines_xe (bufmgr ,
10931094 context -> engine_class ,
10941095 context -> engine_caps ,
@@ -1120,7 +1121,7 @@ __mos_context_restore_xe(struct mos_bufmgr *bufmgr,
11201121 //restore
11211122 context -> ctx .ctx_id = create .exec_queue_id ;
11221123 context -> reset_count += 1 ;
1123-
1124+ MOS_SafeFreeMemory ( engine_map );
11241125 return MOS_XE_SUCCESS ;
11251126}
11261127
@@ -2484,7 +2485,7 @@ mos_bo_context_exec_with_sync_xe(struct mos_linux_bo **bo, int num_bo, struct mo
24842485 struct mos_xe_bufmgr_gem * bufmgr_gem = (struct mos_xe_bufmgr_gem * ) bo [0 ]-> bufmgr ;
24852486 MOS_DRM_CHK_NULL_RETURN_VALUE (bufmgr_gem , - EINVAL )
24862487
2487- uint64_t batch_addrs [ num_bo ] ;
2488+ uint64_t * batch_addrs = ( uint64_t * ) MOS_AllocAndZeroMemory ( num_bo * sizeof ( uint64_t )) ;
24882489
24892490 std ::vector < mos_xe_exec_bo > exec_list ;
24902491 for (int i = 0 ; i < num_bo ; i ++ )
@@ -2518,6 +2519,7 @@ mos_bo_context_exec_with_sync_xe(struct mos_linux_bo **bo, int num_bo, struct mo
25182519 {
25192520 MOS_DRM_ASSERTMESSAGE ("Failed to initial context timeline dep" );
25202521 bufmgr_gem -> m_lock .unlock ();
2522+ MOS_SafeFreeMemory (batch_addrs );
25212523 return - ENOMEM ;
25222524 }
25232525 }
@@ -2619,7 +2621,7 @@ mos_bo_context_exec_with_sync_xe(struct mos_linux_bo **bo, int num_bo, struct mo
26192621 {
26202622 mos_sync_syncobj_destroy (bufmgr_gem -> fd , temp_syncobj );
26212623 }
2622-
2624+ MOS_SafeFreeMemory ( batch_addrs );
26232625 //Note: keep exec return value for final return value.
26242626 return ret ;
26252627}
0 commit comments