X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=ztest%2Fread-marc.c;h=82abe546a1ff0666c11860af29457825ed606151;hb=62fd62f25a6893d042c4c87f8c770929fd8cf95d;hp=eb4463105315be38437f85db9c3c3eaed3be62fd;hpb=fb6d99a0c7e07d9cc4a315c447deaf6564a85505;p=yaz-moved-to-github.git diff --git a/ztest/read-marc.c b/ztest/read-marc.c index eb44631..82abe54 100644 --- a/ztest/read-marc.c +++ b/ztest/read-marc.c @@ -1,8 +1,8 @@ /* - * Copyright (C) 1995-2005, Index Data ApS + * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: read-marc.c,v 1.7 2005-06-25 15:46:09 adam Exp $ + * $Id: read-marc.c,v 1.9 2007-03-19 14:40:08 adam Exp $ */ /* @@ -1602,8 +1602,8 @@ char *dummy_marc_record (int num, ODR odr) char *dummy_xml_record (int num, ODR odr) { yaz_marc_t mt = yaz_marc_create(); - char *result; - int rlen; + const char *result; + size_t rlen; char *rec = dummy_marc_record (num, odr); int len; @@ -1613,7 +1613,11 @@ char *dummy_xml_record (int num, ODR odr) yaz_marc_xml(mt, YAZ_MARC_MARCXML); len = yaz_marc_decode_buf (mt, rec, -1, &result, &rlen); if (len > 1) - rec = (char *) odr_strdup(odr, result); + { + rec = odr_malloc(odr, rlen+1); + memcpy(rec, result, rlen); + rec[rlen] = '\0'; + } yaz_marc_destroy(mt); return rec; }