[PATCH libXfont 1/4] FreeType: Correct an allocation size

Jeremy Huddleston Sequoia jeremyhu at apple.com
Mon May 30 07:53:43 UTC 2016


Found by clang static analysis:
    Result of 'calloc' is converted to a pointer of type 'int', which is
    incompatible with sizeof operand type 'int *'

This is likely benign because the old size was larger on any platform where
sizeof(int) <= sizeof(void *), which is everywhere.

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
---
 src/FreeType/ftfuncs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/FreeType/ftfuncs.c b/src/FreeType/ftfuncs.c
index bbd4db4..e7c8026 100644
--- a/src/FreeType/ftfuncs.c
+++ b/src/FreeType/ftfuncs.c
@@ -623,7 +623,7 @@ FreeTypeInstanceFindGlyph(unsigned idx_in, int flags, FTInstancePtr instance,
     offset = idx - segment * FONTSEGMENTSIZE;
 
     if((*available)[segment] == NULL) {
-        (*available)[segment] = calloc(FONTSEGMENTSIZE, sizeof(int *));
+        (*available)[segment] = calloc(FONTSEGMENTSIZE, sizeof(int));
         if((*available)[segment] == NULL)
             return AllocError;
     }
-- 
2.8.3



More information about the xorg-devel mailing list