|
@ -30,7 +30,7 @@ |
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|
|
.\" SUCH DAMAGE. |
|
|
.\" SUCH DAMAGE. |
|
|
.\" |
|
|
.\" |
|
|
.\" $OpenBSD: malloc.3,v 1.30 2003/09/25 11:10:56 deraadt Exp $ |
|
|
|
|
|
|
|
|
.\" $OpenBSD: malloc.3,v 1.31 2003/09/26 05:57:02 millert Exp $ |
|
|
.\" |
|
|
.\" |
|
|
.Dd August 27, 1996 |
|
|
.Dd August 27, 1996 |
|
|
.Dt MALLOC 3 |
|
|
.Dt MALLOC 3 |
|
@ -159,8 +159,7 @@ Better code looks like this: |
|
|
.Bd -literal -offset indent |
|
|
.Bd -literal -offset indent |
|
|
newsize = size + 50; |
|
|
newsize = size + 50; |
|
|
if ((newp = realloc(p, newsize)) == NULL) { |
|
|
if ((newp = realloc(p, newsize)) == NULL) { |
|
|
if (p) |
|
|
|
|
|
free(p); |
|
|
|
|
|
|
|
|
free(p); |
|
|
p = NULL; |
|
|
p = NULL; |
|
|
size = 0; |
|
|
size = 0; |
|
|
return (NULL); |
|
|
return (NULL); |
|
|