From d0145e03799e484f3a53d79de3b3f34162ee9d3c Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 24 Apr 2006 08:55:46 +0000 Subject: Updated to fedora-glibc-20060424T0820 --- libio/fmemopen.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'libio') diff --git a/libio/fmemopen.c b/libio/fmemopen.c index b847f62c9a..f3b280092c 100644 --- a/libio/fmemopen.c +++ b/libio/fmemopen.c @@ -1,5 +1,5 @@ /* Fmemopen implementation. - Copyright (C) 2000, 2002, 2005 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Hanno Mueller, kontakt@hanno.de, 2000. @@ -202,7 +202,7 @@ fmemopen (void *buf, size_t len, const char *mode) cookie_io_functions_t iof; fmemopen_cookie_t *c; - if (len == 0) + if (__builtin_expect (len == 0, 0)) { einval: __set_errno (EINVAL); @@ -227,8 +227,11 @@ fmemopen (void *buf, size_t len, const char *mode) } else { - if ((uintptr_t) len > -(uintptr_t) buf) - goto einval; + if (__builtin_expect ((uintptr_t) len > -(uintptr_t) buf, 0)) + { + free (c); + goto einval; + } c->buffer = buf; } -- cgit v1.2.3