diff options
author | tholo <> | 1996-09-19 20:38:48 +0000 |
---|---|---|
committer | tholo <> | 1996-09-19 20:38:48 +0000 |
commit | ed150626d7f9f9e2a8ed1c480bbd8bf09cfc107a (patch) | |
tree | edc210e9be581ba35eba2a752d0cb3ad5b41a81e /src | |
parent | 9b25cbf97ec9b0c0fe72bf7024007a17a16b4b4a (diff) | |
download | openbsd-ed150626d7f9f9e2a8ed1c480bbd8bf09cfc107a.tar.gz openbsd-ed150626d7f9f9e2a8ed1c480bbd8bf09cfc107a.tar.bz2 openbsd-ed150626d7f9f9e2a8ed1c480bbd8bf09cfc107a.zip |
From FreeBSD:
> Fix a very rare error condition: The code to free VM back to the kernel
> as done after a quasi-recursive call to free() had modified what we
> thought we knew about the last chunk of pages.
> This bug manifested itself when I did a "make obj" from src/usr.sbin/lpr,
> then make would coredump in the lpd directory.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libc/stdlib/malloc.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index 780980e7cb..bff70c7b54 100644 --- a/src/lib/libc/stdlib/malloc.c +++ b/src/lib/libc/stdlib/malloc.c | |||
@@ -8,7 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #if defined(LIBC_SCCS) && !defined(lint) | 10 | #if defined(LIBC_SCCS) && !defined(lint) |
11 | static char rcsid[] = "$OpenBSD: malloc.c,v 1.12 1996/09/16 05:43:40 tholo Exp $"; | 11 | static char rcsid[] = "$OpenBSD: malloc.c,v 1.13 1996/09/19 20:38:48 tholo Exp $"; |
12 | #endif /* LIBC_SCCS and not lint */ | 12 | #endif /* LIBC_SCCS and not lint */ |
13 | 13 | ||
14 | /* | 14 | /* |
@@ -1019,7 +1019,7 @@ free_pages(ptr, index, info) | |||
1019 | struct pginfo *info; | 1019 | struct pginfo *info; |
1020 | { | 1020 | { |
1021 | int i; | 1021 | int i; |
1022 | struct pgfree *pf,*pt; | 1022 | struct pgfree *pf,*pt=0; |
1023 | u_long l; | 1023 | u_long l; |
1024 | void *tail; | 1024 | void *tail; |
1025 | 1025 | ||
@@ -1090,7 +1090,6 @@ free_pages(ptr, index, info) | |||
1090 | pf->next = pt->next; | 1090 | pf->next = pt->next; |
1091 | if (pf->next) | 1091 | if (pf->next) |
1092 | pf->next->prev = pf; | 1092 | pf->next->prev = pf; |
1093 | free(pt); | ||
1094 | } | 1093 | } |
1095 | } else if (pf->page == tail) { | 1094 | } else if (pf->page == tail) { |
1096 | /* Prepend to entry */ | 1095 | /* Prepend to entry */ |
@@ -1132,6 +1131,8 @@ free_pages(ptr, index, info) | |||
1132 | 1131 | ||
1133 | /* XXX: We could realloc/shrink the pagedir here I guess. */ | 1132 | /* XXX: We could realloc/shrink the pagedir here I guess. */ |
1134 | } | 1133 | } |
1134 | if (pt) | ||
1135 | free(pt); | ||
1135 | } | 1136 | } |
1136 | 1137 | ||
1137 | /* | 1138 | /* |