--- a/src/locate_soundfont.c
+++ b/src/locate_soundfont.c
@@ -32,7 +32,7 @@
 fsd_locate_soundfont_file(const char *origpath, const char *projectDirectory)
 {
     struct stat statbuf;
-    char *sf2path, *path, *origPath, *element, *eltpath;
+    char *sf2path, *path, *origPath, *element, *context, *eltpath;
     const char *filename;
 
     if (stat(origpath, &statbuf) == 0)
@@ -64,7 +64,7 @@
 
     origPath = path;
 
-    while ((element = strtok(path, ":")) != 0) {
+    while ((element = strtok_r(path, ":", &context)) != 0) {
 
 	path = 0;