diff options
author | Lukas Larsson <[email protected]> | 2014-08-08 11:51:27 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2014-08-08 11:51:27 +0200 |
commit | 2525622c384b27581c4b4cb158fc951f15ac5ca3 (patch) | |
tree | 15c62ac68a08fe211e5663212e0d8fbdbed0d8f2 /erts/emulator/beam/erl_lock_count.c | |
parent | bf4d615f04002aebca4e340f9fa0aaf3888e84e2 (diff) | |
parent | ad57501215fc02a39abf3fbce978dbc43d010859 (diff) | |
download | otp-2525622c384b27581c4b4cb158fc951f15ac5ca3.tar.gz otp-2525622c384b27581c4b4cb158fc951f15ac5ca3.tar.bz2 otp-2525622c384b27581c4b4cb158fc951f15ac5ca3.zip |
Merge branch 'lukas/erts/malloc_failure_errors/OTP-12085' into maint
* lukas/erts/malloc_failure_errors/OTP-12085:
erts: Print error reason when malloc fails
Diffstat (limited to 'erts/emulator/beam/erl_lock_count.c')
-rw-r--r-- | erts/emulator/beam/erl_lock_count.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/erts/emulator/beam/erl_lock_count.c b/erts/emulator/beam/erl_lock_count.c index 17ddfdc8ae..cf6996ea06 100644 --- a/erts/emulator/beam/erl_lock_count.c +++ b/erts/emulator/beam/erl_lock_count.c @@ -151,6 +151,9 @@ static erts_lcnt_thread_data_t *lcnt_thread_data_alloc(void) { erts_lcnt_thread_data_t *eltd; eltd = (erts_lcnt_thread_data_t*)malloc(sizeof(erts_lcnt_thread_data_t)); + if (!eltd) { + ERTS_INTERNAL_ERROR("Lock counter failed to allocate memory!"); + } eltd->timer_set = 0; eltd->lock_in_conflict = 0; @@ -272,6 +275,9 @@ void erts_lcnt_init() { /* init lcnt structure */ erts_lcnt_data = (erts_lcnt_data_t*)malloc(sizeof(erts_lcnt_data_t)); + if (!erts_lcnt_data) { + ERTS_INTERNAL_ERROR("Lock counter failed to allocate memory!"); + } erts_lcnt_data->current_locks = erts_lcnt_list_init(); erts_lcnt_data->deleted_locks = erts_lcnt_list_init(); @@ -293,6 +299,9 @@ erts_lcnt_lock_list_t *erts_lcnt_list_init(void) { erts_lcnt_lock_list_t *list; list = (erts_lcnt_lock_list_t*)malloc(sizeof(erts_lcnt_lock_list_t)); + if (!list) { + ERTS_INTERNAL_ERROR("Lock counter failed to allocate memory!"); + } list->head = NULL; list->tail = NULL; list->n = 0; @@ -399,6 +408,9 @@ void erts_lcnt_destroy_lock(erts_lcnt_lock_t *lock) { /* copy structure and insert the copy */ deleted_lock = (erts_lcnt_lock_t*)malloc(sizeof(erts_lcnt_lock_t)); + if (!deleted_lock) { + ERTS_INTERNAL_ERROR("Lock counter failed to allocate memory!"); + } memcpy(deleted_lock, lock, sizeof(erts_lcnt_lock_t)); deleted_lock->next = NULL; |