aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_alarmreceiver.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/app_alarmreceiver.c')
-rw-r--r--apps/app_alarmreceiver.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/apps/app_alarmreceiver.c b/apps/app_alarmreceiver.c
index 7c36b60b8..e7310ef23 100644
--- a/apps/app_alarmreceiver.c
+++ b/apps/app_alarmreceiver.c
@@ -56,6 +56,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/localtime.h"
#include "asterisk/callerid.h"
#include "asterisk/astdb.h"
+#include "asterisk/utils.h"
#define ALMRCV_CONFIG "alarmreceiver.conf"
#define ADEMCO_CONTACT_ID "ADEMCO_CONTACT_ID"
@@ -579,17 +580,11 @@ static int receive_ademco_contact_id( struct ast_channel *chan, void *data, int
events_received++;
- /* Queue the Event */
-
- if((enew = malloc(sizeof(event_node_t))) == NULL){
- if(option_verbose >= 1)
- ast_verbose(VERBOSE_PREFIX_1 "AlarmReceiver: Failed to allocate memory\n");
- ast_log(LOG_WARNING, "AlarmReceiver Failed to allocate memory\n");
+ /* Queue the Event */
+ if (!(enew = ast_calloc(1, sizeof(*enew)))) {
res = -1;
- break;
+ break;
}
-
- memset(enew, 0, sizeof(event_node_t));
enew->next = NULL;
ast_copy_string(enew->data, event, sizeof(enew->data));