Signed-off-by: Ander Conselvan de Oliveira 
<[email protected]>
---
 modules/om/generic/omGeneric.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/modules/om/generic/omGeneric.c b/modules/om/generic/omGeneric.c
index ec2abc0..6088350 100644
--- a/modules/om/generic/omGeneric.c
+++ b/modules/om/generic/omGeneric.c
@@ -2121,22 +2121,24 @@ init_om(
     if (required_list == NULL)
        return False;
 
-    bufptr = (char *) Xmalloc(length);
-    if (bufptr == NULL) {
-       Xfree(required_list);
-       return False;
-    }
-
     om->core.required_charset.charset_list = required_list;
     om->core.required_charset.charset_count = gen->data_num;
 
     count = gen->data_num;
     data = gen->data;
 
-    for ( ; count-- > 0; data++) {
-       strcpy(bufptr, data->font_data->name);
-       *required_list++ = bufptr;
-       bufptr += strlen(bufptr) + 1;
+    if (count > 0) {
+       bufptr = (char *) Xmalloc(length);
+       if (bufptr == NULL) {
+           Xfree(required_list);
+           return False;
+       }
+
+       for ( ; count-- > 0; data++) {
+           strcpy(bufptr, data->font_data->name);
+           *required_list++ = bufptr;
+           bufptr += strlen(bufptr) + 1;
+       }
     }
 
     /* orientation list */
-- 
1.7.0.4

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to