Avoid test failures on AIX and OSF/1.
[gnulib.git] / lib / uniwbrk / ulc-wordbreaks.c
index 85e4efd..b97b13d 100644 (file)
@@ -64,9 +64,9 @@ ulc_wordbreaks (const char *s, size_t n, char *p)
                                         s, n, offsets, &t, &m)
                  == 0)
                {
-                 char *q = (char *) malloc (m);
+                 char *q = (char *) (m > 0 ? malloc (m) : NULL);
 
-                 if (q != NULL)
+                 if (m == 0 || q != NULL)
                    {
                      size_t i;