diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libc/stdlib/malloc.3 | 11 | ||||
| -rw-r--r-- | src/lib/libc/stdlib/malloc.c | 5 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/libc/stdlib/malloc.3 b/src/lib/libc/stdlib/malloc.3 index eb09eeedbc..6fd362b93b 100644 --- a/src/lib/libc/stdlib/malloc.3 +++ b/src/lib/libc/stdlib/malloc.3 | |||
| @@ -33,7 +33,7 @@ | |||
| 33 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 33 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | .\" SUCH DAMAGE. | 34 | .\" SUCH DAMAGE. |
| 35 | .\" | 35 | .\" |
| 36 | .\" $OpenBSD: malloc.3,v 1.6 1997/05/31 08:55:05 tholo Exp $ | 36 | .\" $OpenBSD: malloc.3,v 1.7 1997/08/23 10:43:24 pefo Exp $ |
| 37 | .\" | 37 | .\" |
| 38 | .Dd August 27, 1996 | 38 | .Dd August 27, 1996 |
| 39 | .Dt MALLOC 3 | 39 | .Dt MALLOC 3 |
| @@ -77,6 +77,8 @@ coercion) for storage of any type of object. If the space is of | |||
| 77 | .Em pagesize | 77 | .Em pagesize |
| 78 | or larger, the memory returned will be page-aligned. | 78 | or larger, the memory returned will be page-aligned. |
| 79 | .Pp | 79 | .Pp |
| 80 | Allocation of a zero size object returns a pointer to a zero size object. | ||
| 81 | .Pp | ||
| 80 | The | 82 | The |
| 81 | .Fn free | 83 | .Fn free |
| 82 | function causes the space pointed to by | 84 | function causes the space pointed to by |
| @@ -120,7 +122,8 @@ If | |||
| 120 | .Fa size | 122 | .Fa size |
| 121 | is zero and | 123 | is zero and |
| 122 | .Fa ptr | 124 | .Fa ptr |
| 123 | is not a null pointer, the object it points to is freed. | 125 | is not a null pointer, the object it points to is freed and a new zero size |
| 126 | object is returned. | ||
| 124 | .Pp | 127 | .Pp |
| 125 | Malloc will first look for a symbolic link called | 128 | Malloc will first look for a symbolic link called |
| 126 | .Pa /etc/malloc.conf | 129 | .Pa /etc/malloc.conf |
| @@ -211,8 +214,8 @@ function returns no value. | |||
| 211 | .Pp | 214 | .Pp |
| 212 | The | 215 | The |
| 213 | .Fn realloc | 216 | .Fn realloc |
| 214 | function returns either a null pointer or a pointer | 217 | function a pointer to the possibly moved allocated space; |
| 215 | to the possibly moved allocated space. | 218 | otherwise a null pointer is returned. |
| 216 | .Sh MESSAGES | 219 | .Sh MESSAGES |
| 217 | If | 220 | If |
| 218 | .Fn malloc , | 221 | .Fn malloc , |
diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index 12cc67083d..66d1a2a9da 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.28 1997/08/22 17:06:59 deraadt Exp $"; | 11 | static char rcsid[] = "$OpenBSD: malloc.c,v 1.29 1997/08/23 10:43:25 pefo Exp $"; |
| 12 | #endif /* LIBC_SCCS and not lint */ | 12 | #endif /* LIBC_SCCS and not lint */ |
| 13 | 13 | ||
| 14 | /* | 14 | /* |
| @@ -1234,9 +1234,6 @@ realloc(void *ptr, size_t size) | |||
| 1234 | } | 1234 | } |
| 1235 | if (!ptr) { | 1235 | if (!ptr) { |
| 1236 | r = imalloc(size); | 1236 | r = imalloc(size); |
| 1237 | } else if (ptr && !size) { | ||
| 1238 | ifree(ptr); | ||
| 1239 | r = 0; | ||
| 1240 | } else { | 1237 | } else { |
| 1241 | r = irealloc(ptr, size); | 1238 | r = irealloc(ptr, size); |
| 1242 | } | 1239 | } |
