Fix null deref and memleak in lang.v

This commit is contained in:
Sergi Àlvarez i Capilla 2021-06-09 17:07:06 +02:00
parent a391811663
commit 5887d1ec72

View File

@ -26,9 +26,12 @@ static const char *r2v_body = \
"pub fn (core &R2)cmd(s string) string {\n"
" unsafe {\n"
" o := C.r_core_cmd_str (core, s.str)\n"
" strs := o.vstring()\n"
" // free(o)\n"
" return strs\n"
" if o != 0 {\n"
" strs := o.vstring()\n"
" free(o)\n"
" return strs\n"
" }\n"
" return ''\n"
" }\n"
"}\n"
"\n"