probes-app: add allocation check

This will check if the allocation succeeded

Signed-off-by: Adrian Bonislawski <adrian.bonislawski@linux.intel.com>
This commit is contained in:
Adrian Bonislawski 2020-03-16 18:18:11 +01:00 committed by Liam Girdwood
parent 2765b22049
commit f1fa3be980
1 changed files with 6 additions and 0 deletions

View File

@ -199,6 +199,12 @@ void parse_data(char *file_in)
}
packet = malloc(PACKET_MAX_SIZE);
if (!packet) {
fprintf(stderr, "error: allocation failed, err %d\n",
errno);
fclose(fd_in);
exit(0);
}
memset(&data, 0, sizeof(uint32_t) * DATA_READ_LIMIT);
memset(&files, 0, sizeof(struct wave_files) * FILES_LIMIT);