BUG/MEDIUM: lua: Don't crash in hlua_lua2arg_check on failure

In hlua_lua2arg_check(), on failure, before calling free_argp(), make
sure to always mark the failed argument as ARGT_STOP. We only want to
free argument prior to that point, because we did not allocate the
strings after this one, and so we don't want to free them.

This should be backported up to 2.2.

(cherry picked from commit ca43161a8da278ec0948511f595827daf29a071e)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit bb0cb68fe63e56a43f8b41084d1e760116c76fbc)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 12c0a07ec8bafcb31a9ca88324e279023e465029)
[cf: context adj]
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/hlua.c b/src/hlua.c
index d220d6d..5482f1b 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -979,6 +979,7 @@
 	return 0;
 
   error:
+	argp[idx].type = ARGT_STOP;
 	for (i = 0; i < idx; i++) {
 		if (argp[i].type == ARGT_STR)
 			chunk_destroy(&argp[i].data.str);