From e2ff50333584634256bedec27f7d4834b430ea6a Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Fri, 23 Feb 2018 18:57:35 +0000 Subject: [PATCH] Move the additional free() call that was added to bbs.replace_text(), otherwise we are always freeing the pointer that was asigned the text.dat list and things will crash (thanks for the report, Rastus). --- src/sbbs3/js_bbs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sbbs3/js_bbs.cpp b/src/sbbs3/js_bbs.cpp index ef19b32fca..5f1ad1e9f9 100644 --- a/src/sbbs3/js_bbs.cpp +++ b/src/sbbs3/js_bbs.cpp @@ -1416,11 +1416,11 @@ js_replace_text(JSContext *cx, uintN argc, jsval *arglist) if(!len) { sbbs->text[i]=nulstr; JS_SET_RVAL(cx, arglist, JSVAL_TRUE); + free(p); } else { sbbs->text[i]=p; JS_SET_RVAL(cx, arglist, JSVAL_TRUE); } - free(p); return(JS_TRUE); } -- GitLab