From 2c0c91a47236c0cfcb178bd6683069284ca3691c Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 17 Jan 2005 22:12:51 +0000 Subject: [PATCH] Fix leak data1_iconv --- data1/d1_read.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/data1/d1_read.c b/data1/d1_read.c index 742e170..fa7f241 100644 --- a/data1/d1_read.c +++ b/data1/d1_read.c @@ -1,4 +1,4 @@ -/* $Id: d1_read.c,v 1.9 2004-08-04 08:35:22 adam Exp $ +/* $Id: d1_read.c,v 1.8.2.1 2005-01-17 22:12:51 adam Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -470,8 +470,8 @@ data1_node *data1_add_taggeddata (data1_handle dh, data1_node *root, return data1_add_insert_taggeddata (dh, at, tagname, m, 1, 0); } -data1_node *data1_mk_tag_data_zint (data1_handle dh, data1_node *at, - const char *tag, zint num, +data1_node *data1_mk_tag_data_int (data1_handle dh, data1_node *at, + const char *tag, int num, NMEM nmem) { data1_node *node_data; @@ -481,18 +481,11 @@ data1_node *data1_mk_tag_data_zint (data1_handle dh, data1_node *at, return 0; node_data->u.data.what = DATA1I_num; node_data->u.data.data = node_data->lbuf; - sprintf (node_data->u.data.data, ZINT_FORMAT, num); + sprintf (node_data->u.data.data, "%d", num); node_data->u.data.len = strlen (node_data->u.data.data); return node_data; } -data1_node *data1_mk_tag_data_int (data1_handle dh, data1_node *at, - const char *tag, int num, - NMEM nmem) -{ - return data1_mk_tag_data_zint(dh, at, tag, num, nmem); -} - data1_node *data1_mk_tag_data_oid (data1_handle dh, data1_node *at, const char *tag, Odr_oid *oid, NMEM nmem) @@ -1112,7 +1105,10 @@ int data1_iconv (data1_handle dh, NMEM m, data1_node *n, WRBUF wrbuf = wrbuf_alloc(); yaz_iconv_t t = yaz_iconv_open (tocode, fromcode); if (!t) + { + wrbuf_free(wrbuf, 1); return -1; + } data1_iconv_s (dh, m, n, t, wrbuf, tocode); yaz_iconv_close (t); wrbuf_free (wrbuf, 1); -- 1.7.10.4