diff options
author | 2016-12-17 13:23:44 -0500 | |
---|---|---|
committer | 2016-12-17 13:23:44 -0500 | |
commit | f04ee0e68d885d7e1101cc88f9a9337202041f1f (patch) | |
tree | fa4dc296a5f1377867752d320ceef4e4b0178bbf /common/list.c | |
parent | Merge pull request #991 from barfoo1/registry_fix (diff) | |
parent | Fix build error (diff) | |
download | sway-f04ee0e68d885d7e1101cc88f9a9337202041f1f.tar.gz sway-f04ee0e68d885d7e1101cc88f9a9337202041f1f.tar.zst sway-f04ee0e68d885d7e1101cc88f9a9337202041f1f.zip |
Merge pull request #995 from SirCmpwn/memory-use
Handle allocation failures
Diffstat (limited to 'common/list.c')
-rw-r--r-- | common/list.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/common/list.c b/common/list.c index d57234e3..dd864a9b 100644 --- a/common/list.c +++ b/common/list.c | |||
@@ -5,6 +5,9 @@ | |||
5 | 5 | ||
6 | list_t *create_list(void) { | 6 | list_t *create_list(void) { |
7 | list_t *list = malloc(sizeof(list_t)); | 7 | list_t *list = malloc(sizeof(list_t)); |
8 | if (!list) { | ||
9 | return NULL; | ||
10 | } | ||
8 | list->capacity = 10; | 11 | list->capacity = 10; |
9 | list->length = 0; | 12 | list->length = 0; |
10 | list->items = malloc(sizeof(void*) * list->capacity); | 13 | list->items = malloc(sizeof(void*) * list->capacity); |