diff options
Diffstat (limited to 'src/lib/libc')
| -rw-r--r-- | src/lib/libc/string/strdup.3 | 7 | 
1 files changed, 5 insertions, 2 deletions
| diff --git a/src/lib/libc/string/strdup.3 b/src/lib/libc/string/strdup.3 index 457b8322cf..2734bf4593 100644 --- a/src/lib/libc/string/strdup.3 +++ b/src/lib/libc/string/strdup.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: strdup.3,v 1.8 2000/04/21 15:24:20 aaron Exp $ | 1 | .\" $OpenBSD: strdup.3,v 1.9 2000/04/21 15:27:40 aaron Exp $ | 
| 2 | .\" | 2 | .\" | 
| 3 | .\" Copyright (c) 1990, 1991, 1993 | 3 | .\" Copyright (c) 1990, 1991, 1993 | 
| 4 | .\" The Regents of the University of California. All rights reserved. | 4 | .\" The Regents of the University of California. All rights reserved. | 
| @@ -63,7 +63,10 @@ to an allocated area of memory containing the null-terminated string | |||
| 63 | .Bd -literal -offset indent | 63 | .Bd -literal -offset indent | 
| 64 | char *p; | 64 | char *p; | 
| 65 | 65 | ||
| 66 | p = strdup("foobar"); | 66 | if ((p = strdup("foobar")) == NULL) { | 
| 67 | fprintf(stderr, "Out of memory.\en"); | ||
| 68 | exit(1); | ||
| 69 | } | ||
| 67 | .Ed | 70 | .Ed | 
| 68 | .Sh SEE ALSO | 71 | .Sh SEE ALSO | 
| 69 | .Xr free 3 , | 72 | .Xr free 3 , | 
