mirror of
git://git.savannah.gnu.org/libtool.git
synced 2025-01-24 14:24:59 +08:00
* libltdl/lt__alloc.c (lt__memdup): Allocation can fail, so we
need to guard against null pointer dereference here. * libltdl/ltdl.c (lt_dlcaller_register): Ditto.
This commit is contained in:
parent
921d06b537
commit
9bc5390549
@ -1,5 +1,9 @@
|
||||
2004-10-01 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
|
||||
|
||||
* libltdl/lt__alloc.c (lt__memdup): Allocation can fail, so we
|
||||
need to guard against null pointer dereference here.
|
||||
* libltdl/ltdl.c (lt_dlcaller_register): Ditto.
|
||||
|
||||
* libltdl/slist.c (slist_foreach): result was declared as
|
||||
inner variable, shadowing the actually returned value.
|
||||
|
||||
|
@ -82,7 +82,12 @@ lt__realloc (void *mem, size_t n)
|
||||
void *
|
||||
lt__memdup (void const *mem, size_t n)
|
||||
{
|
||||
return memcpy (lt__malloc (n), mem, n);
|
||||
void *newmem;
|
||||
|
||||
if ((newmem = lt__malloc (n)))
|
||||
return memcpy (newmem, mem, n);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *
|
||||
|
@ -1992,8 +1992,13 @@ lt_dlcaller_register (const char *id_string, lt_dlhandle_interface *iface)
|
||||
{
|
||||
lt__caller_id *caller_id = lt__malloc (sizeof *caller_id);
|
||||
|
||||
caller_id->id_string = lt__strdup (id_string);
|
||||
caller_id->iface = iface;
|
||||
/* If lt__malloc fails, it will LT__SETERROR (NO_MEMORY), which
|
||||
can then be detected with lt_dlerror() if we return 0. */
|
||||
if (caller_id)
|
||||
{
|
||||
caller_id->id_string = lt__strdup (id_string);
|
||||
caller_id->iface = iface;
|
||||
}
|
||||
|
||||
return (lt_dlcaller_id) caller_id;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user