]> granicus.if.org Git - imagemagick/commitdiff
...
authorCristy <urban-warrior@imagemagick.org>
Sat, 7 Oct 2017 20:43:37 +0000 (16:43 -0400)
committerCristy <urban-warrior@imagemagick.org>
Sat, 7 Oct 2017 20:43:37 +0000 (16:43 -0400)
MagickCore/utility.c

index 1306ecc4c1195fd11c888b3db0abdb5f67a6e892..06b3c8d54f71ddbd715cb1a51a44b13de58e6019 100644 (file)
@@ -1058,8 +1058,7 @@ MagickPrivate MagickBooleanType GetExecutionPath(char *path,const size_t extent)
 #if defined(__GNU__)
   {
     char
-      *program_name,
-      *execution_path;
+      *program_name;
 
     ssize_t
       count;
@@ -1082,13 +1081,14 @@ MagickPrivate MagickBooleanType GetExecutionPath(char *path,const size_t extent)
       }
     if (count != -1)
       {
-        execution_path=realpath(program_name,NULL);
-        if (execution_path != (char *) NULL)
+        char
+          execution_path[PATH_MAX+1];
+
+        if (realpath(program_name,execution_path) != (char *) NULL)
           (void) CopyMagickString(path,execution_path,extent);
       }
     if (program_name != program_invocation_name)
       program_name=(char *) RelinquishMagickMemory(program_name);
-    execution_path=(char *) RelinquishMagickMemory(execution_path);
   }
 #endif
 #if defined(__OpenBSD__)