[UTC][wav-player/tone-player][Non-ACR][mobile/wearable/TV][Fix memory leak issue]
authorSeungbae Shin <seungbae.shin@samsung.com>
Wed, 8 Jun 2016 05:52:52 +0000 (14:52 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Wed, 8 Jun 2016 07:03:17 +0000 (16:03 +0900)
Change-Id: I9b00731bbbce1a82627a0dd9cc36502d418f93ca

src/utc/tone-player/utc-tone-player.c
src/utc/wav-player/utc-wav-player.c

index 8b140a3..b5401f1 100755 (executable)
@@ -81,9 +81,13 @@ int utc_tone_player_start_with_stream_info_p(void)
 
     ret = sound_manager_create_stream_information(SOUND_STREAM_TYPE_MEDIA, _sound_stream_focus_state_changed_cb, NULL, &stream_info);
     assert_eq(ret, SOUND_MANAGER_ERROR_NONE);
+
     ret = tone_player_start_with_stream_info(TONE_TYPE_DEFAULT, stream_info, DURATION, NULL);
     assert_eq(ret, TONE_PLAYER_ERROR_NONE);
 
+    ret = sound_manager_destroy_stream_information(stream_info);
+    assert_eq(ret, SOUND_MANAGER_ERROR_NONE);
+
     return 0;
 }
 
@@ -101,9 +105,13 @@ int utc_tone_player_start_with_stream_info_n1(void)
 
     ret = sound_manager_create_stream_information(SOUND_STREAM_TYPE_MEDIA, _sound_stream_focus_state_changed_cb, NULL, &stream_info);
     assert_eq(ret, SOUND_MANAGER_ERROR_NONE);
+
     ret = tone_player_start_with_stream_info(-1, stream_info, DURATION, NULL);
     assert_eq(ret, TONE_PLAYER_ERROR_INVALID_PARAMETER);
 
+    ret = sound_manager_destroy_stream_information(stream_info);
+    assert_eq(ret, SOUND_MANAGER_ERROR_NONE);
+
     return 0;
 }
 
@@ -157,10 +165,16 @@ int utc_tone_player_stop_p2(void)
 
     ret = sound_manager_create_stream_information(SOUND_STREAM_TYPE_MEDIA, _sound_stream_focus_state_changed_cb, NULL, &stream_info);
     assert_eq(ret, SOUND_MANAGER_ERROR_NONE);
+
     ret = tone_player_start_with_stream_info(TONE_TYPE_DEFAULT, stream_info, DURATION, &id);
     assert_eq(ret, TONE_PLAYER_ERROR_NONE);
+
     ret = tone_player_stop(id);
     assert_eq(ret, TONE_PLAYER_ERROR_NONE);
+
+    ret = sound_manager_destroy_stream_information(stream_info);
+    assert_eq(ret, SOUND_MANAGER_ERROR_NONE);
+
     return 0;
 }
 
index ba3bb04..f480c35 100755 (executable)
@@ -115,8 +115,13 @@ int utc_wav_player_start_with_stream_info_p(void)
 
     ret = sound_manager_create_stream_information(SOUND_STREAM_TYPE_MEDIA, _sound_stream_focus_state_changed_cb, NULL, &stream_info);
     assert_eq(ret, SOUND_MANAGER_ERROR_NONE);
+
     ret = wav_player_start_with_stream_info(TESTFILE, stream_info, NULL, NULL, NULL);
     assert_eq(WAV_PLAYER_ERROR_NONE, ret);
+
+    ret = sound_manager_destroy_stream_information(stream_info);
+    assert_eq(ret, SOUND_MANAGER_ERROR_NONE);
+
     return 0;
 }
 
@@ -134,8 +139,13 @@ int utc_wav_player_start_with_stream_info_n1(void)
 
     ret = sound_manager_create_stream_information(SOUND_STREAM_TYPE_MEDIA, _sound_stream_focus_state_changed_cb, NULL, &stream_info);
     assert_eq(ret, SOUND_MANAGER_ERROR_NONE);
+
     ret = wav_player_start_with_stream_info(NULL, stream_info, NULL, NULL, NULL);
     assert_eq(WAV_PLAYER_ERROR_INVALID_PARAMETER, ret);
+
+    ret = sound_manager_destroy_stream_information(stream_info);
+    assert_eq(ret, SOUND_MANAGER_ERROR_NONE);
+
     return 0;
 }
 
@@ -180,16 +190,22 @@ int utc_wav_player_stop_p1(void)
  */
 int utc_wav_player_stop_p2(void)
 {
-    int ret = WAV_PLAYER_ERROR_INVALID_PARAMETER, id = 0;
+    int ret = WAV_PLAYER_ERROR_INVALID_PARAMETER;
+    int id = 0;
     sound_stream_info_h stream_info;
 
     ret = sound_manager_create_stream_information(SOUND_STREAM_TYPE_MEDIA, _sound_stream_focus_state_changed_cb, NULL, &stream_info);
     assert_eq(ret, SOUND_MANAGER_ERROR_NONE);
+
     ret = wav_player_start_with_stream_info(TESTFILE, stream_info, NULL, NULL, &id);
     assert_eq(WAV_PLAYER_ERROR_NONE, ret);
+
     ret = wav_player_stop(id);
     assert_eq(WAV_PLAYER_ERROR_NONE, ret);
 
+    ret = sound_manager_destroy_stream_information(stream_info);
+    assert_eq(ret, SOUND_MANAGER_ERROR_NONE);
+
     return 0;
 }
 
@@ -370,5 +386,8 @@ int utc_wav_player_callback_p3(void)
 
     assert_eq(cb_ret, 1);
 
+    ret = sound_manager_destroy_stream_information(stream_info);
+    assert_eq(ret, SOUND_MANAGER_ERROR_NONE);
+
     return 0;
 }