From 44cd4e63f58fe240b1d8259600a60757f1bd2ce8 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 8 Apr 2017 04:31:02 +0300 Subject: [PATCH] unittests: Use Neovim memory allocation for vimconv_T Not sure whether this is going to fix things though, but core dump does not contain Neovim functions in stack in this case. --- test/unit/eval/typval_spec.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/unit/eval/typval_spec.lua b/test/unit/eval/typval_spec.lua index e26e1c918f..53ef299fce 100644 --- a/test/unit/eval/typval_spec.lua +++ b/test/unit/eval/typval_spec.lua @@ -743,10 +743,13 @@ describe('typval.c', function() collectgarbage() end) itp('copies list correctly and converts items', function() - local vc = ffi.gc(ffi.new('vimconv_T[1]'), function(vc) - lib.convert_setup(vc, nil, nil) - end) - -- UTF-8 ↔ latin1 conversions need no iconv + local vc = ffi.gc( + ffi.cast('vimconv_T*', lib.xcalloc(1, ffi.sizeof('vimconv_T'))), + function(vc) + lib.convert_setup(vc, nil, nil) + lib.xfree(vc) + end) + -- UTF-8 ↔ latin1 conversions needs no iconv eq(OK, lib.convert_setup(vc, to_cstr('utf-8'), to_cstr('latin1'))) local v = {{['«']='»'}, {'„'}, 1, '“', null_string, null_list, null_dict}