tinyalsa: Fix debug info data type mismatch error and potential
risk of wild pointer
1 There are debug info data type mismatch in file of tinycap.c
/tinymix.c/tinypcminfo.c
2 There is a risk of wild pointer when abnormally abort
Test: mma, built and ran on device without errors
Bug: None
Change-Id: I7241a67229faf78d8741dc199e7b5799e4de3b10
diff --git a/tinycap.c b/tinycap.c
index fe80de7..cea98a1 100644
--- a/tinycap.c
+++ b/tinycap.c
@@ -157,7 +157,8 @@
format = PCM_FORMAT_S16_LE;
break;
default:
- fprintf(stderr, "%d bits is not supported.\n", bits);
+ fprintf(stderr, "%u bits is not supported.\n", bits);
+ fclose(file);
return 1;
}
@@ -176,7 +177,7 @@
frames = capture_sample(file, card, device, header.num_channels,
header.sample_rate, format,
period_size, period_count, cap_time);
- printf("Captured %d frames\n", frames);
+ printf("Captured %u frames\n", frames);
/* write header now all information is known */
header.data_sz = frames * header.block_align;
@@ -222,7 +223,7 @@
size = pcm_frames_to_bytes(pcm, pcm_get_buffer_size(pcm));
buffer = malloc(size);
if (!buffer) {
- fprintf(stderr, "Unable to allocate %d bytes\n", size);
+ fprintf(stderr, "Unable to allocate %u bytes\n", size);
free(buffer);
pcm_close(pcm);
return 0;