Fix for Coverity CID#2: false bug, but still a problem.
Analysis: internal_errorf(int, fmt, ...) was only a __dead function if the int argument was non-0, which the Prevent probably was unable to follow. Change all uses of internal_errorf(0, fmt, ...) to internal_warningf(fmt, ...); change the pro- totype of internal_errorf() to internal_errorf(fmt, ...) and all remaining uses remove the non-0 int argument; add __dead to internal_errorf() proto; flesh out guts of internal_errorf() and internal_warningf() into a new local function for optimisation purposes. Some whitespace cleanup and dead code removal (return after internal_errorf(1))
This commit is contained in:
6
alloc.c
6
alloc.c
@ -29,7 +29,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/alloc.c,v 1.4 2007/03/04 03:04:23 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/alloc.c,v 1.5 2007/05/13 17:51:20 tg Exp $");
|
||||
|
||||
struct link {
|
||||
struct link *prev;
|
||||
@ -64,7 +64,7 @@ alloc(size_t size, Area *ap)
|
||||
struct link *l;
|
||||
|
||||
if ((l = malloc(sizeof (struct link) + size)) == NULL)
|
||||
internal_errorf(1, "unable to allocate memory");
|
||||
internal_errorf("unable to allocate memory");
|
||||
l->next = ap->freelist;
|
||||
l->prev = NULL;
|
||||
if (ap->freelist)
|
||||
@ -87,7 +87,7 @@ aresize(void *ptr, size_t size, Area *ap)
|
||||
lnext = l->next;
|
||||
|
||||
if ((l2 = realloc(l, sizeof (struct link) + size)) == NULL)
|
||||
internal_errorf(1, "unable to allocate memory");
|
||||
internal_errorf("unable to allocate memory");
|
||||
if (lprev)
|
||||
lprev->next = l2;
|
||||
else
|
||||
|
Reference in New Issue
Block a user