~hp/netatom.lv2

768cd96706538f048bb227f5f7449d9326de45bf — Hanspeter Portner 6 months ago 5257b80
Fix potential memleak in test
2 files changed, 3 insertions(+), 12 deletions(-)

M meson_options.txt
M test/test.c
M meson_options.txt => meson_options.txt +1 -1
@@ 6,4 6,4 @@ option('build-tests',
	value : true,
  yield : true)

option('version', type : 'string', value : '0.3.1')
option('version', type : 'string', value : '0.3.3')

M test/test.c => test/test.c +2 -11
@@ 20,7 20,7 @@ typedef struct _store_t store_t;

struct _urid_t {
	LV2_URID urid;
	char *uri;
	char uri [256];
};

struct _store_t {


@@ 44,7 44,7 @@ _map(LV2_URID_Map_Handle instance, const char *uri)

	// create new
	itm->urid = ++handle->urid;
	itm->uri = strdup(uri);
	snprintf(itm->uri, sizeof(itm->uri), "%s", uri);

	return itm->urid;
}


@@ 65,13 65,6 @@ _unmap(LV2_URID_Unmap_Handle instance, LV2_URID urid)
}

static void
_freemap(store_t *handle)
{
	for(urid_t *itm = handle->urids; itm->urid; itm++)
		free(itm->uri);
}

static void
_netatom_test(LV2_URID_Map *map, LV2_URID_Unmap *unmap, bool swap,
	const LV2_Atom *atom, unsigned iterations)
{


@@ 268,7 261,5 @@ main(int argc, char **argv)
	const double d2 = (t2.tv_sec - t1.tv_sec) + (t2.tv_nsec - t1.tv_nsec) * 1e-9;
	fprintf(stderr, "%lf s, %lf s, x %lf\n", d1, d2, d2/d1);

	_freemap(&handle);

	return 0;
}