summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-02-27 09:31:33 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2017-02-27 09:31:33 +0100
commite5d40e32d1f01b98c7344dae3707a38720e08666 (patch)
treef068ea01e31b146994d1c45f2dc1f5e3554f0645
parent13bd63c1bd4055cba1316042267b31c4776af256 (diff)
fix SEGFLT when unhendled request
Change-Id: I34c657972111db843d0d9d26a1732b21ac519c57 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/afb-hsrv.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/afb-hsrv.c b/src/afb-hsrv.c
index 91dff296..577ef854 100644
--- a/src/afb-hsrv.c
+++ b/src/afb-hsrv.c
@@ -238,9 +238,11 @@ static void end_handler(void *cls, struct MHD_Connection *connection, void **rec
struct afb_hreq *hreq;
hreq = *recordreq;
- if (hreq->upgrade)
- MHD_suspend_connection (connection);
- afb_hreq_unref(hreq);
+ if (hreq) {
+ if (hreq->upgrade)
+ MHD_suspend_connection (connection);
+ afb_hreq_unref(hreq);
+ }
}
void run_micro_httpd(struct afb_hsrv *hsrv)