Autoreconf
[moonshot-ui.git] / libmoonshot / libmoonshot-common.c
index 4161528..d40849c 100644 (file)
@@ -38,9 +38,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-MoonshotError *_moonshot_error_new (MoonshotErrorCode  code,
-                                    const char        *format,
-                                    ...)
+MoonshotError *moonshot_error_new (MoonshotErrorCode  code,
+                                   const char        *format,
+                                   ...)
 {
     MoonshotError *error;
     int            buffer_size;
@@ -55,6 +55,7 @@ MoonshotError *_moonshot_error_new (MoonshotErrorCode  code,
     buffer_size = _vscprintf (format, args);
     error->message = malloc (buffer_size + 1);
     _vsnprintf (error->message, buffer_size, format, args);
+    error->message[buffer_size] = 0;
     #else
     vasprintf (&error->message, format, args);
     #endif