1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-11 14:10:34 +00:00

save_realloc() should use reallocf() to close memory leaks.

item_add() should use safe_realloc() as it does no error checking itself.
This commit is contained in:
David E. O'Brien 2003-01-06 17:11:46 +00:00
parent 5b398f68ee
commit efd394684a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=108804
2 changed files with 4 additions and 4 deletions

View File

@ -206,7 +206,7 @@ safe_realloc(void *orig, size_t size)
if (size <= 0)
msgFatal("Invalid realloc size of %ld!", (long)size);
ptr = realloc(orig, size);
ptr = reallocf(orig, size);
if (!ptr)
msgFatal("Out of memory!");
return ptr;
@ -243,7 +243,7 @@ item_add(dialogMenuItem *list, char *prompt, char *title,
if (*curr == *max) {
*max += 20;
list = (dialogMenuItem *)realloc(list, sizeof(dialogMenuItem) * *max);
list = (dialogMenuItem *)safe_realloc(list, sizeof(dialogMenuItem) * *max);
}
d = &list[(*curr)++];
bzero(d, sizeof(*d));

View File

@ -206,7 +206,7 @@ safe_realloc(void *orig, size_t size)
if (size <= 0)
msgFatal("Invalid realloc size of %ld!", (long)size);
ptr = realloc(orig, size);
ptr = reallocf(orig, size);
if (!ptr)
msgFatal("Out of memory!");
return ptr;
@ -243,7 +243,7 @@ item_add(dialogMenuItem *list, char *prompt, char *title,
if (*curr == *max) {
*max += 20;
list = (dialogMenuItem *)realloc(list, sizeof(dialogMenuItem) * *max);
list = (dialogMenuItem *)safe_realloc(list, sizeof(dialogMenuItem) * *max);
}
d = &list[(*curr)++];
bzero(d, sizeof(*d));