mirror of
https://github.com/openharmony/third_party_tinyalsa.git
synced 2026-07-18 13:25:09 -04:00
Fixed segfault
This commit is contained in:
@@ -20,21 +20,21 @@ static size_t read_file(void ** frames){
|
||||
FILE * input_file = fopen("audio.raw", "rb");
|
||||
if (input_file == NULL) {
|
||||
perror("failed to open 'audio.raw' for writing");
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
long int size = file_size(input_file);
|
||||
if (size < 0) {
|
||||
perror("failed to get file size of 'audio.raw'");
|
||||
fclose(input_file);
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
*frames = malloc(size);
|
||||
if (*frames == NULL) {
|
||||
fprintf(stderr, "failed to allocate frames\n");
|
||||
fclose(input_file);
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
size = fread(*frames, 1, size, input_file);
|
||||
|
||||
Reference in New Issue
Block a user