Coverity: Forward NULL: CID 35
authorNelson Ferreira <nelson.ferreira@ieee.org>
Fri, 20 Jan 2012 17:49:52 +0000 (12:49 -0500)
committerNelson Ferreira <nelson.ferreira@ieee.org>
Fri, 20 Jan 2012 17:49:52 +0000 (12:49 -0500)
* src/mem/ralloc.c (r_re_alloc): Make sure bloc is only
dereferenced if not NULL even in fatal crash case.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
src/mem/ralloc.c

index bd55ca3..7185afa 100644 (file)
@@ -954,7 +954,7 @@ POINTER r_re_alloc(POINTER * ptr, size_t size)
        if (bloc == NIL_BLOC)
                abort();
 
-       if (size < bloc->size) {
+       else if (size < bloc->size) {
                /* Wouldn't it be useful to actually resize the bloc here?  */
                /* I think so too, but not if it's too expensive...  */
                if ((bloc->size - MEM_ROUNDUP(size) >= page_size)