Syscall param open(filename) points to unaddressable byte(s)

时间:2021-05-01 09:03:56

valgrind 调试出现如题所示的错误,原因是存取文件名的空间被释放了

源代码:

        cfg->snteam_cfg->snt.score.nd.wrd_dict_db_fn=cfg->wrd_dict_db_fn;

修改之后:

	cfg->snteam_cfg->snt.heap = wtk_heap_new(1024);
cfg->snteam_cfg->snt.score.nd.wrd_dict_db_fn= wtk_heap_dup_str(cfg->snteam_cfg->snt.heap, cfg->wrd_dict_db_fn);