1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

spa: allow instantiation with no parse array

If you just want a "file" in multipart, don't care about the length or
anything else, then you don't need any params tables and associated
allocations.
This commit is contained in:
Andy Green 2019-03-22 11:23:06 +08:00
parent 62c5a784e3
commit f7860b6ac6

View file

@ -508,19 +508,23 @@ lws_spa_create(struct lws *wsi, const char * const *param_names,
goto bail2;
spa->end = spa->storage + max_storage - 1;
spa->params = lws_zalloc(sizeof(char *) * count_params, "spa params");
if (!spa->params)
goto bail3;
if (count_params) {
spa->params = lws_zalloc(sizeof(char *) * count_params, "spa params");
if (!spa->params)
goto bail3;
}
spa->s = lws_urldecode_s_create(wsi, spa->storage, max_storage, spa,
lws_urldecode_spa_cb);
if (!spa->s)
goto bail4;
spa->param_length = lws_zalloc(sizeof(int) * count_params,
"spa param len");
if (!spa->param_length)
goto bail5;
if (count_params) {
spa->param_length = lws_zalloc(sizeof(int) * count_params,
"spa param len");
if (!spa->param_length)
goto bail5;
}
lwsl_info("%s: Created SPA %p\n", __func__, spa);