[rtems-libbsd commit] rtems-bsd-malloc.c - Add _bsd_reallocf()

Joel Sherrill joel at rtems.org
Fri May 18 18:34:17 UTC 2012


Module:    rtems-libbsd
Branch:    master
Commit:    5382b1f1a4ae60ca663ae12740e319c5ad2b2b5c
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=5382b1f1a4ae60ca663ae12740e319c5ad2b2b5c

Author:    Joel Sherrill <joel.sherrill at oarcorp.com>
Date:      Fri May 18 13:37:19 2012 -0500

rtems-bsd-malloc.c - Add _bsd_reallocf()

---

 rtemsbsd/src/rtems-bsd-malloc.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/rtemsbsd/src/rtems-bsd-malloc.c b/rtemsbsd/src/rtems-bsd-malloc.c
index 27faf3f..244f6a6 100644
--- a/rtemsbsd/src/rtems-bsd-malloc.c
+++ b/rtemsbsd/src/rtems-bsd-malloc.c
@@ -96,8 +96,21 @@ _bsd_realloc( void *addr, unsigned long size,
 	return p;
 }
 
-#undef free
+#undef reallocf
+void *
+_bsd_reallocf( void *addr, unsigned long size, 
+  struct malloc_type *type, int flags)
+{
+	void *p = realloc(addr, size);
 
+	if (p == NULL) {
+		free(addr,NULL);
+	}
+
+	return p;
+}
+
+#undef free
 void
 _bsd_free(void *addr, struct malloc_type *mtp)
 {




More information about the vc mailing list