diff --git a/alliance/src/aut/src/autenv.c b/alliance/src/aut/src/autenv.c index f12534c6..a409bfc1 100644 --- a/alliance/src/aut/src/autenv.c +++ b/alliance/src/aut/src/autenv.c @@ -45,6 +45,7 @@ # include # include # include +# include # include # include "aut.h" @@ -118,8 +119,16 @@ char *autbasename( Name, Extension ) { int Index; char *NewName; + char *NewNameTmp; - NewName = basename( mbkstrdup( Name ) ); + NewNameTmp = mbkstrdup( Name ); + + NewName = mbkstrdup (basename( NewNameTmp ) ); + /* We copy the result of basename because basename */ + /* can return a pointer to internal static storage */ + /* space on systems like Darwin */ + + mbkfree(NewNameTmp); if ( Extension != (char *)0 ) {