eqctl: Add check for calloc() success and return 0 in exit

This patch adds the missed details into the code.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This commit is contained in:
Seppo Ingalsuo 2018-10-15 19:20:26 +03:00
parent c0a881a3b7
commit 7a8ed190e8
1 changed files with 7 additions and 0 deletions

View File

@ -196,6 +196,12 @@ int main(int argc, char *argv[])
*/
buffer_size = ctrl_size + 2 * sizeof(unsigned int);
user_data = calloc(1, buffer_size);
if (!user_data) {
fprintf(stderr,
"Error: Failed to allocate buffer for user data.\n");
exit(EXIT_FAILURE);
}
user_data[0] = SOF_CTRL_CMD_BINARY;
if (set) {
fprintf(stdout, "Applying configuration \"%s\" ", setup);
@ -242,4 +248,5 @@ int main(int argc, char *argv[])
}
}
free(user_data);
return 0;
}