I now always build the export list
[platform/upstream/ltrace.git] / prototype.c
index 7f91897..fa52ff3 100644 (file)
@@ -342,9 +342,8 @@ consider_config_dir(struct protolib_cache *cache,
                    const char *path, const char *key)
 {
        size_t len = sizeof ".conf";
-       char slash[2] = {'/'};
        char *buf = alloca(strlen(path) + 1 + strlen(key) + len);
-       strcpy(stpcpy(stpcpy(stpcpy(buf, path), slash), key), ".conf");
+       sprintf(buf, "%s/%s.conf", path, key);
 
        return protolib_cache_file(cache, buf, 0);
 }
@@ -564,11 +563,11 @@ protolib_cache_maybe_load(struct protolib_cache *cache,
            || (*retp == NULL
                && load_config(cache, key, 0, retp) < 0))
        {
-               if (!own_key)
-                       free((void *) key);
                fprintf(stderr,
                        "Error occurred when attempting to load a prototype "
                        "library for %s.\n", key);
+               if (!own_key)
+                       free((void *) key);
                return -1;
        }