Skip to content
This repository was archived by the owner on Jan 17, 2019. It is now read-only.

Commit 5b51dc0

Browse files
authored
Merge pull request #108 from singalsu/eqctl_check_calloc_and_return_zero
eqctl: Add check for calloc() success and return 0 in exit
2 parents b37b8ef + 7a8ed19 commit 5b51dc0

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

eqctl/eqctl.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,12 @@ int main(int argc, char *argv[])
196196
*/
197197
buffer_size = ctrl_size + 2 * sizeof(unsigned int);
198198
user_data = calloc(1, buffer_size);
199+
if (!user_data) {
200+
fprintf(stderr,
201+
"Error: Failed to allocate buffer for user data.\n");
202+
exit(EXIT_FAILURE);
203+
}
204+
199205
user_data[0] = SOF_CTRL_CMD_BINARY;
200206
if (set) {
201207
fprintf(stdout, "Applying configuration \"%s\" ", setup);
@@ -242,4 +248,5 @@ int main(int argc, char *argv[])
242248
}
243249
}
244250
free(user_data);
251+
return 0;
245252
}

0 commit comments

Comments
 (0)