diff options
author | David Robillard <d@drobilla.net> | 2019-04-14 11:11:24 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-04-14 11:18:00 +0200 |
commit | ac237a888cbd2ffe8446adc8a51482e603ca3765 (patch) | |
tree | d5521f5993fe668e446fac316fa447e12ee3d749 /src | |
parent | 1a80c081cc2f3bf38f01512734c0001e4a1d295e (diff) | |
download | lilv-ac237a888cbd2ffe8446adc8a51482e603ca3765.tar.gz lilv-ac237a888cbd2ffe8446adc8a51482e603ca3765.tar.bz2 lilv-ac237a888cbd2ffe8446adc8a51482e603ca3765.zip |
Fix Windows cross-library malloc/free errors
Diffstat (limited to 'src')
-rw-r--r-- | src/lib.c | 11 | ||||
-rw-r--r-- | src/node.c | 6 | ||||
-rw-r--r-- | src/state.c | 7 |
3 files changed, 15 insertions, 9 deletions
@@ -40,7 +40,8 @@ lilv_lib_open(LilvWorld* world, } const char* const lib_uri = lilv_node_as_uri(uri); - char* const lib_path = lilv_file_uri_parse(lib_uri, NULL); + char* const lib_path = (char*)serd_file_uri_parse( + (const uint8_t*)lib_uri, NULL); if (!lib_path) { return NULL; } @@ -49,7 +50,7 @@ lilv_lib_open(LilvWorld* world, void* lib = dlopen(lib_path, RTLD_NOW); if (!lib) { LILV_ERRORF("Failed to open library %s (%s)\n", lib_path, dlerror()); - lilv_free(lib_path); + serd_free(lib_path); return NULL; } @@ -65,17 +66,17 @@ lilv_lib_open(LilvWorld* world, if (!desc) { LILV_ERRORF("Call to %s:lv2_lib_descriptor failed\n", lib_path); dlclose(lib); - lilv_free(lib_path); + serd_free(lib_path); return NULL; } } else if (!df) { LILV_ERRORF("No `lv2_descriptor' or `lv2_lib_descriptor' in %s\n", lib_path); dlclose(lib); - lilv_free(lib_path); + serd_free(lib_path); return NULL; } - lilv_free(lib_path); + serd_free(lib_path); LilvLib* llib = (LilvLib*)malloc(sizeof(LilvLib)); llib->world = world; @@ -283,11 +283,13 @@ lilv_node_get_turtle_token(const LilvNode* value) break; case LILV_VALUE_INT: node = serd_node_new_integer(value->val.int_val); - result = (char*)node.buf; + result = lilv_strdup((char*)node.buf); + serd_node_free(&node); break; case LILV_VALUE_FLOAT: node = serd_node_new_decimal(value->val.float_val, 8); - result = (char*)node.buf; + result = lilv_strdup((char*)node.buf); + serd_node_free(&node); break; } diff --git a/src/state.c b/src/state.c index 2b6b113..3841c75 100644 --- a/src/state.c +++ b/src/state.c @@ -618,7 +618,7 @@ new_state_from_model(LilvWorld* world, sord_node_free(world->world, state_node); sord_node_free(world->world, statep); - free((void*)chunk.buf); + serd_free((void*)chunk.buf); sratom_free(sratom); if (state->props.props) { @@ -1153,7 +1153,10 @@ lilv_state_to_string(LilvWorld* world, serd_writer_free(writer); serd_env_free(env); - return (char*)serd_chunk_sink_finish(&chunk); + char* str = (char*)serd_chunk_sink_finish(&chunk); + char* result = lilv_strdup(str); + serd_free(str); + return result; } static void |