Namazu-users-en(old)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Access Violation on nmz_get_field_data
- From: "Carlos J. Soltero-Pales" <carlos@xxxxxxxxx>
- Date: Wed, 06 Mar 2002 10:00:56 -0500
- X-ml-name: namazu-users-en
- X-mail-count: 00238
- References: <200203060729.QAA03160@ns1.eal.or.jp>
> I think you need to call nmz_free_hlist(nmz_data_current_hit) on each
> iteration, and need to call nmz_free_internal() before second try.
>
> I don't know it causes such probrem or not, but it would be better.
>
Thank you very much for the quick response. I tried the functions you
suggested, and still had the problem. I did get it to work, though, by
passing heap-allocated buffers of size BUFSIZE (defined in libnamazu.h)
for the fieldname and data parameters of nmz_get_field_data. I suspect
there must be an overwrite of sorts in the function. Below is the code:
nmz_add_index("C:\\namazu\\index");
NmzResult result = nmz_search("Some query");
for (int i = 0; i < result.num; i++)
{
nmz_data current_hit = result.data[i];
char * title = (char*)malloc(BUFSIZE);
char * field = (char*)malloc(BUFSIZE);
memset (title, 0, BUFSIZE);
strcpy(field, "title");
nmz_get_field_data(current_hit.idxid, current_hit.docid, field, title);
free(title);
free(field);
}
nmz_free_hlist(result);
nmz_free_internal();
Regards,
-Carlos