diff options
Diffstat (limited to 'nuttx/graphics/nxbe')
-rw-r--r-- | nuttx/graphics/nxbe/nxbe_clipper.c | 8 | ||||
-rw-r--r-- | nuttx/graphics/nxbe/nxbe_colormap.c | 7 |
2 files changed, 10 insertions, 5 deletions
diff --git a/nuttx/graphics/nxbe/nxbe_clipper.c b/nuttx/graphics/nxbe/nxbe_clipper.c index cdbd421c0..1c33dd243 100644 --- a/nuttx/graphics/nxbe/nxbe_clipper.c +++ b/nuttx/graphics/nxbe/nxbe_clipper.c @@ -1,7 +1,7 @@ /**************************************************************************** * graphics/nxbe/nxbe_clipper.c * - * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -44,7 +44,9 @@ #include <stdlib.h> #include <debug.h> +#include <nuttx/kmalloc.h> #include <nuttx/nx/nxglib.h> + #include "nxbe.h" /**************************************************************************** @@ -113,7 +115,7 @@ static inline void nxbe_pushrectangle(FAR struct nxbe_clipstack_s *stack, int mxrects = stack->mxrects ? 2 * stack->mxrects : NX_INITIAL_STACKSIZE; struct nxbe_cliprect_s *newstack; - newstack = realloc(stack->stack, sizeof(struct nxbe_cliprect_s) * mxrects); + newstack = krealloc(stack->stack, sizeof(struct nxbe_cliprect_s) * mxrects); if (!newstack) { gdbg("Failed to reallocate stack\n"); @@ -258,7 +260,7 @@ void nxbe_clipper(FAR struct nxbe_window_s *wnd, if (stack.stack) { - free(stack.stack); + kfree(stack.stack); } } diff --git a/nuttx/graphics/nxbe/nxbe_colormap.c b/nuttx/graphics/nxbe/nxbe_colormap.c index e33877382..89e6baace 100644 --- a/nuttx/graphics/nxbe/nxbe_colormap.c +++ b/nuttx/graphics/nxbe/nxbe_colormap.c @@ -45,6 +45,8 @@ #include <errno.h> #include <debug.h> +#include <nuttx/kmalloc.h> + #include "nxbe.h" /**************************************************************************** @@ -100,11 +102,12 @@ int nxbe_colormap(FAR NX_DRIVERTYPE *dev) */ size = 3 * CONFIG_NX_NCOLORS * sizeof(uint8_t); - alloc = (uint8_t*)malloc(size); + alloc = (uint8_t*)kmalloc(size); if (alloc == NULL) { return -ENOMEM; } + memset(alloc, 0xff, size); /* Then get pointers to each color table */ @@ -149,7 +152,7 @@ int nxbe_colormap(FAR NX_DRIVERTYPE *dev) ret = dev->putcmap(dev, &cmap); - free(alloc); + kfree(alloc); return ret; } #endif |