Skip to content

Commit

Permalink
feat: add malloc failure check
Browse files Browse the repository at this point in the history
  • Loading branch information
eshaz committed Dec 25, 2023
1 parent fa8dfc5 commit ae98d2c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/devices/compustar_1wg3r.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ static int compustar_1wg3r_decode(r_device *decoder, bitbuffer_t *bitbuffer)
{
int rows_data_idx = -1;
data_t **rows_data = malloc(bitbuffer->num_rows * sizeof(data_t *));
if (!rows_data) {
WARN_MALLOC("compustar_1wg3r_decode()");

Check warning on line 64 in src/devices/compustar_1wg3r.c

View workflow job for this annotation

GitHub Actions / Build with CMake

implicit declaration of function ‘WARN_MALLOC’ [-Wimplicit-function-declaration]
return -1; // NOTE: returns error on alloc failure.
}

// loop through all of the rows and only return unique valid results
// programming mode will send a sequence of key presses all in one message
Expand Down

0 comments on commit ae98d2c

Please sign in to comment.