diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index bead03a8a6f49e13a196bc5c4a20b4505bc67d8b..8f4da6f5603aeb600584e6c4a241168f3ab39e4a 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -7956,6 +7956,9 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
 	struct ast_frame *f;
 
 	idx = dahdi_get_index(ast, p, 0);
+	if (idx < 0) {
+		return &ast_null_frame;
+	}
 	mysig = p->sig;
 	if (p->outsigmod > -1)
 		mysig = p->outsigmod;
@@ -7969,8 +7972,6 @@ static struct ast_frame *dahdi_handle_event(struct ast_channel *ast)
 	p->subs[idx].f.data.ptr = NULL;
 	f = &p->subs[idx].f;
 
-	if (idx < 0)
-		return &p->subs[idx].f;
 	if (p->fake_event) {
 		res = p->fake_event;
 		p->fake_event = 0;
diff --git a/res/res_calendar_ews.c b/res/res_calendar_ews.c
index d33f4be4fb1c41de67f57b839584c988bf2f9af1..7deca9c97553de5ef31299f19b7606f08b56cbdc 100644
--- a/res/res_calendar_ews.c
+++ b/res/res_calendar_ews.c
@@ -233,7 +233,7 @@ static int startelm(void *userdata, int parent, const char *nspace, const char *
 		/* Event UID */
 		if (ctx->op == XML_OP_FIND) {
 			struct calendar_id *id;
-			if (!(id = ast_calloc(1, sizeof(id)))) {
+			if (!(id = ast_calloc(1, sizeof(*id)))) {
 				return NE_XML_ABORT;
 			}
 			if (!(id->id = ast_str_create(256))) {