summaryrefslogtreecommitdiffstats
path: root/src/sratom.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-12-16 10:52:37 +0100
committerDavid Robillard <d@drobilla.net>2020-12-16 10:52:37 +0100
commit02027eec2603a83218cb837d6c33b601e8ef8efa (patch)
tree4389190a374569dab7164dbed4e77bcd253a1e27 /src/sratom.c
parent0f84ab1b34e684f3e80c75296ded90eaf27c49fc (diff)
downloadsratom-02027eec2603a83218cb837d6c33b601e8ef8efa.tar.gz
sratom-02027eec2603a83218cb837d6c33b601e8ef8efa.tar.bz2
sratom-02027eec2603a83218cb837d6c33b601e8ef8efa.zip
Fix potential null pointer dereference
Diffstat (limited to 'src/sratom.c')
-rw-r--r--src/sratom.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/sratom.c b/src/sratom.c
index 248906f..57f4667 100644
--- a/src/sratom.c
+++ b/src/sratom.c
@@ -748,8 +748,15 @@ read_node(Sratom* sratom,
SerdNode rel = serd_node_new_relative_uri(&uri, &sratom->base, NULL, NULL);
uint8_t* path = serd_file_uri_parse(rel.buf, NULL);
- lv2_atom_forge_path(forge, (const char*)path, strlen((const char*)path));
- serd_free(path);
+ if (path) {
+ lv2_atom_forge_path(forge,
+ (const char*)path,
+ strlen((const char*)path));
+ serd_free(path);
+ } else {
+ // FIXME: Report errors (required API change)
+ lv2_atom_forge_atom(forge, 0, 0);
+ }
serd_node_free(&rel);
} else {
lv2_atom_forge_urid(forge, map->map(map->handle, str));