aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-08-16 07:21:27 -0400
committerGitHub <noreply@github.com>2017-08-16 07:21:27 -0400
commit2164adc5136e91e5d9d5d0f67f792185f1c66658 (patch)
tree8e83344aeadb70c3449baa663d02d7013c542d62 /examples
parent19d6442f52743d50d10c796d7146f58c251f67fe (diff)
parent901c14c409e6e8143ade06a7478241e558cfb79c (diff)
Merge pull request #95 from 4e554c4c/list_api
Prevent alloc errors from crashing in `list_t`
Diffstat (limited to 'examples')
-rw-r--r--examples/touch.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/touch.c b/examples/touch.c
index a32c76ba..7e01a6c2 100644
--- a/examples/touch.c
+++ b/examples/touch.c
@@ -65,7 +65,9 @@ static void handle_touch_down(struct touch_state *tstate, int32_t slot,
point->slot = slot;
point->x = x / width;
point->y = y / height;
- list_add(sample->touch_points, point);
+ if (list_add(sample->touch_points, point) == -1) {
+ free(point);
+ }
}
static void handle_touch_up(struct touch_state *tstate, int32_t slot) {