@@ -173,7 +173,6 @@ void BTE_InitStack(void)
173173#endif // PAN
174174#endif // BNEP Included
175175
176-
177176 //AVDT and its profiles
178177#if (defined(A2D_INCLUDED ) && A2D_INCLUDED == TRUE )
179178 A2D_Init ();
@@ -229,6 +228,12 @@ void BTE_InitStack(void)
229228 memset ((void * )bta_dm_di_cb_ptr , 0 , sizeof (tBTA_DM_DI_CB ));
230229 //memset((void *)bta_prm_cb_ptr, 0, sizeof(tBTA_PRM_CB));
231230 //memset((void *)bta_ag_cb_ptr, 0, sizeof(tBTA_AG_CB));
231+ #if (defined BTA_JV_INCLUDED && BTA_JV_INCLUDED == TRUE )
232+ if ((bta_jv_cb_ptr = (tBTA_JV_CB * )osi_malloc (sizeof (tBTA_JV_CB ))) == NULL ) {
233+ return ;
234+ }
235+ memset ((void * )bta_jv_cb_ptr , 0 , sizeof (tBTA_JV_CB ));
236+ #endif //JV
232237#if BTA_HS_INCLUDED == TRUE
233238 memset ((void * )bta_hs_cb_ptr , 0 , sizeof (tBTA_HS_CB ));
234239#endif
@@ -253,7 +258,7 @@ void BTE_InitStack(void)
253258#if BTA_HH_INCLUDED == TRUE
254259 if ((bta_hh_cb_ptr = (tBTA_HH_CB * )osi_malloc (sizeof (tBTA_HH_CB ))) == NULL ) {
255260 return ;
256- }
261+ }
257262 memset ((void * )bta_hh_cb_ptr , 0 , sizeof (tBTA_HH_CB ));
258263#endif
259264#if BTA_HL_INCLUDED == TRUE
@@ -277,3 +282,76 @@ void BTE_InitStack(void)
277282
278283#endif // BTA_INCLUDED == TRUE
279284}
285+
286+ /*****************************************************************************
287+ **
288+ ** Function BTE_DeinitStack
289+ **
290+ ** Description Deinitialize control block memory for each component.
291+ **
292+ ** Note: This API must be called
293+ ** after freeing the BTU Task.
294+ **
295+ ** Returns void
296+ **
297+ ******************************************************************************/
298+ void BTE_DeinitStack (void )
299+ {
300+ //BTA Modules
301+ #if (BTA_INCLUDED == TRUE && BTA_DYNAMIC_MEMORY == TRUE )
302+ #if GATTS_INCLUDED == TRUE
303+ osi_free (bta_gatts_cb_ptr );
304+ bta_gatts_cb_ptr = NULL ;
305+ #endif
306+ #if GATTC_INCLUDED == TRUE
307+ osi_free (bta_gattc_cb_ptr );
308+ bta_gattc_cb_ptr = NULL ;
309+ #endif
310+ #if BTA_HH_INCLUDED == TRUE
311+ osi_free (bta_hh_cb_ptr );
312+ bta_hh_cb_ptr = NULL ;
313+ #endif
314+ #if BTA_AV_INCLUDED == TRUE
315+ osi_free (bta_av_cb_ptr );
316+ bta_av_cb_ptr = NULL ;
317+ #endif
318+ #if BTA_AR_INCLUDED == TRUE
319+ osi_free (bta_ar_cb_ptr );
320+ bta_ar_cb_ptr = NULL ;
321+ #endif
322+ #if BTA_SDP_INCLUDED == TRUE
323+ osi_free (bta_sdp_cb_ptr );
324+ bta_sdp_cb_ptr = NULL ;
325+ #endif
326+ #if (defined BTA_JV_INCLUDED && BTA_JV_INCLUDED == TRUE )
327+ osi_free (bta_jv_cb_ptr );
328+ bta_jv_cb_ptr = NULL ;
329+ #endif //JV
330+ osi_free (bta_dm_di_cb_ptr );
331+ bta_dm_di_cb_ptr = NULL ;
332+ osi_free (bta_dm_search_cb_ptr );
333+ bta_dm_search_cb_ptr = NULL ;
334+ osi_free (bta_dm_cb_ptr );
335+ bta_dm_cb_ptr = NULL ;
336+ osi_free (bta_sys_cb_ptr );
337+ bta_sys_cb_ptr = NULL ;
338+ #endif // BTA_INCLUDED == TRUE
339+
340+ #if (defined(AVCT_INCLUDED ) && AVCT_INCLUDED == TRUE && AVCT_DYNAMIC_MEMORY == TRUE )
341+ osi_free (avct_cb_ptr );
342+ avct_cb_ptr = NULL ;
343+ #endif
344+
345+ #if (defined(AVDT_INCLUDED ) && AVDT_INCLUDED == TRUE && AVDT_DYNAMIC_MEMORY == TRUE )
346+ osi_free (avdt_cb_ptr );
347+ avdt_cb_ptr = NULL ;
348+ #endif
349+
350+ #if (defined(AVRC_INCLUDED ) && AVRC_INCLUDED == TRUE )
351+ AVRC_Deinit ();
352+ #endif
353+
354+ #if (defined(A2D_INCLUDED ) && A2D_INCLUDED == TRUE )
355+ A2D_Deinit ();
356+ #endif
357+ }
0 commit comments