diff options
-rw-r--r-- | desktop/source/lib/init.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index d753f9a33ed6..696e413b1866 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -9,6 +9,7 @@ #include <stdio.h> #include <string.h> +#include <stdlib.h> #include "liblibreoffice.hxx" @@ -141,7 +142,9 @@ bool LibLODocument_Impl::saveAs (const char *url) char *LibLibreOffice_Impl::getError() { OString aStr = rtl::OUStringToOString( maLastExceptionMsg, RTL_TEXTENCODING_UTF8 ); - return strndup( aStr.getStr(), aStr.getLength() ); + char *pMem = (char *) malloc (aStr.getLength() + 1); + strcpy( pMem, aStr.getStr() ); + return pMem; } static void |