Commit af5e5d48 authored by David Reid's avatar David Reid

Properly initialize-to-zero device info for null and ALSA backends.

parent be216770
...@@ -920,7 +920,7 @@ mal_result mal_enumerate_devices__null(mal_device_type type, mal_uint32* pCount, ...@@ -920,7 +920,7 @@ mal_result mal_enumerate_devices__null(mal_device_type type, mal_uint32* pCount,
*pCount = 1; // There's only one "device" each for playback and recording for the null backend. *pCount = 1; // There's only one "device" each for playback and recording for the null backend.
if (pInfo != NULL && infoSize > 0) { if (pInfo != NULL && infoSize > 0) {
mal_zero_memory(&pInfo->id, sizeof(pInfo->id)); mal_zero_object(pInfo);
if (type == mal_device_type_playback) { if (type == mal_device_type_playback) {
mal_strncpy_s(pInfo->description, sizeof(pInfo->description), "NULL Playback Device", (size_t)-1); mal_strncpy_s(pInfo->description, sizeof(pInfo->description), "NULL Playback Device", (size_t)-1);
...@@ -1731,6 +1731,7 @@ mal_result mal_enumerate_devices__alsa(mal_device_type type, mal_uint32* pCount, ...@@ -1731,6 +1731,7 @@ mal_result mal_enumerate_devices__alsa(mal_device_type type, mal_uint32* pCount,
{ {
if (pInfo != NULL) { if (pInfo != NULL) {
if (infoSize > 0) { if (infoSize > 0) {
mal_zero_object(pInfo);
mal_strncpy_s(pInfo->id.name, sizeof(pInfo->id.name), NAME ? NAME : "", (size_t)-1); mal_strncpy_s(pInfo->id.name, sizeof(pInfo->id.name), NAME ? NAME : "", (size_t)-1);
mal_strncpy_s(pInfo->description, sizeof(pInfo->description), DESC ? DESC : "", (size_t)-1); mal_strncpy_s(pInfo->description, sizeof(pInfo->description), DESC ? DESC : "", (size_t)-1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment