remove lws_ensure_user_space from public api change return

The function has a logical problem when the size of the requested
allocation is 0, it will return NULL which is overloaded as
failure.

Actually the whole function is evil as an api, this patch moves
it out of the public API space and fixes it to return 0 for
success or 1 for fail.  Private code does not need to to return
wsi->user_space and public code should only get that from the
callback as discussed on trac recently.

Thanks to Edwin for debugging the problem.

Reported-by: Edwin van den Oetelaar <oetelaar.automatisering@gmail.com>
Signed-off-by: Andy Green <andy.green@linaro.org>
diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c
index 849ffb4..65adcf5 100644
--- a/lib/libwebsockets.c
+++ b/lib/libwebsockets.c
@@ -2154,16 +2154,11 @@
 	return wsi->u.ws.rsv;
 }
 
-/**
- * libwebsocket_ensure_user_space(): return the user context for the connection if possible
- * @wsi:	websocket connection instance
- */
-
-void *
+int
 libwebsocket_ensure_user_space(struct libwebsocket *wsi)
 {
 	if (!wsi->protocol)
-		return NULL;
+		return 1;
 
 	/* allocate the per-connection user memory (if any) */
 
@@ -2172,12 +2167,12 @@
 				  wsi->protocol->per_session_data_size);
 		if (wsi->user_space  == NULL) {
 			lwsl_err("Out of memory for conn user space\n");
-			return NULL;
+			return 1;
 		}
 		memset(wsi->user_space, 0,
 					 wsi->protocol->per_session_data_size);
 	}
-	return wsi->user_space;
+	return 0;
 }
 
 static void lwsl_emit_stderr(int level, const char *line)