diff -ur fribidi-0.10.7/fribidi.c fribidi-0.10.7-malloc/fribidi.c --- fribidi-0.10.7/fribidi.c Mon Sep 26 01:50:30 2005 +++ fribidi-0.10.7-malloc/fribidi.c Sat Jan 21 00:01:02 2006 @@ -589,7 +589,7 @@ /*====================================================================== * This function should follow the Unicode specification closely! *----------------------------------------------------------------------*/ -static void +static fribidi_boolean fribidi_analyse_string ( /* input */ FriBidiChar *str, FriBidiStrIndex len, @@ -610,6 +610,15 @@ { FriBidiCharType *char_type = (FriBidiCharType *) malloc (len * sizeof (FriBidiCharType)); + if (char_type == NULL) + { +#ifdef DEBUG + fprintf (stderr, "%s: cannot allocate char_type array.\n", + FRIBIDI_PACKAGE); +#endif + return FRIBIDI_FALSE; + } + for (i = 0; i < len; i++) char_type[i] = fribidi_get_type (str[i]); @@ -1037,7 +1046,7 @@ *pbase_dir = base_dir; DBG ("Leaving fribidi_analyse_string()\n"); - return; + return FRIBIDI_TRUE; } /*====================================================================== @@ -1213,9 +1222,10 @@ #endif return FRIBIDI_FALSE; } - fribidi_analyse_string (str, len, pbase_dir, - /* output */ - &type_rl_list, &max_level); + if (! fribidi_analyse_string (str, len, pbase_dir, + /* output */ + &type_rl_list, &max_level)) + return FRIBIDI_FALSE; /* 7. Reordering resolved levels */ DBG ("Reordering resolved levels\n");