]> git.gag.com Git - fw/sdcc/blobdiff - src/SDCCutil.c
fixed *nix build
[fw/sdcc] / src / SDCCutil.c
index b5ce4b302c5c097d0dee0d07ca17c27651f63a43..6673b36378047a3c9882d90c65da99ce795358c1 100644 (file)
@@ -244,7 +244,8 @@ getBinPath(const char *prel)
           dbuf_init(&path, 128);
 
           dbuf_splitPath(module, &path, NULL);
-          return dbuf_c_str(&path);
+          dbuf_c_str(&path);
+          return dbuf_detach(&path);
         }
       else
         return NULL;
@@ -254,16 +255,18 @@ getBinPath(const char *prel)
 const char *
 getBinPath(const char *prel)
 {
-  struct dbuf_s path;
   const char *ret_path;
 
   if (NULL != (ret_path = findProgramPath(prel)))
     {
-      dbuf_splitPath(prel, path, NULL);
+      struct dbuf_s path;
 
-      free((void *)ret_path);
+      dbuf_init(&path, 128);
 
-      return dbuf_c_str(path);
+      dbuf_splitPath(ret_path, &path, NULL);
+      free((void *)ret_path);
+      dbuf_c_str(&path);
+      return dbuf_detach(&path);
     }
   else
     return NULL;