Add explicit cast to (VOID *) on malloc/realloc. Seems to be needed
on AIX which for some reason isn't pulling in the malloc prototype.
This commit is contained in:
16
alloc.c
16
alloc.c
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999-2001 Todd C. Miller <Todd.Miller@courtesan.com>
|
* Copyright (c) 1999-2002 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -58,18 +58,11 @@
|
|||||||
|
|
||||||
#include "sudo.h"
|
#include "sudo.h"
|
||||||
|
|
||||||
#ifndef STDC_HEADERS
|
|
||||||
#if !defined(__GNUC__) && !defined(HAVE_MALLOC_H)
|
|
||||||
extern VOID *malloc __P((size_t));
|
|
||||||
#endif /* !__GNUC__ && !HAVE_MALLOC_H */
|
|
||||||
#endif /* !STDC_HEADERS */
|
|
||||||
|
|
||||||
extern char **Argv; /* from sudo.c */
|
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] = "$Sudo$";
|
static const char rcsid[] = "$Sudo$";
|
||||||
#endif /* lint */
|
#endif /* lint */
|
||||||
|
|
||||||
|
extern char **Argv; /* from sudo.c */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* emalloc() calls the system malloc(3) and exits with an error if
|
* emalloc() calls the system malloc(3) and exits with an error if
|
||||||
@@ -81,7 +74,7 @@ emalloc(size)
|
|||||||
{
|
{
|
||||||
VOID *ptr;
|
VOID *ptr;
|
||||||
|
|
||||||
if ((ptr = malloc(size)) == NULL) {
|
if ((ptr = (VOID *) malloc(size)) == NULL) {
|
||||||
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);
|
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -99,7 +92,8 @@ erealloc(ptr, size)
|
|||||||
size_t size;
|
size_t size;
|
||||||
{
|
{
|
||||||
|
|
||||||
if ((ptr = ptr ? realloc(ptr, size) : malloc(size)) == NULL) {
|
ptr = ptr ? (VOID *) realloc(ptr, size) : (VOID *) malloc(size);
|
||||||
|
if (ptr == NULL) {
|
||||||
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);
|
(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user