diff options
-rw-r--r-- | usr.bin/patch/patch.1 | 13 | ||||
-rw-r--r-- | usr.bin/patch/pch.c | 20 |
2 files changed, 11 insertions, 22 deletions
diff --git a/usr.bin/patch/patch.1 b/usr.bin/patch/patch.1 index 587b166..36ba860 100644 --- a/usr.bin/patch/patch.1 +++ b/usr.bin/patch/patch.1 @@ -19,9 +19,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $OpenBSD: patch.1,v 1.26 2010/09/03 11:09:29 jmc Exp $ +.\" $OpenBSD: patch.1,v 1.27 2014/04/15 06:26:54 jmc Exp $ .\" $FreeBSD$ -.Dd January 29, 2013 +.Dd June 12, 2014 .Dt PATCH 1 .Os .Sh NAME @@ -639,13 +639,10 @@ The .Nm utility is compliant with the .St -p1003.1-2008 -specification -(except as detailed above for the +specification, +except as detailed above for the .Fl -posix -option), -though the presence of -.Nm -itself is optional. +option. .Pp The flags .Op Fl BCEFfstVvxz diff --git a/usr.bin/patch/pch.c b/usr.bin/patch/pch.c index eca12ad..2ca528a 100644 --- a/usr.bin/patch/pch.c +++ b/usr.bin/patch/pch.c @@ -132,11 +132,11 @@ void set_hunkmax(void) { if (p_line == NULL) - p_line = calloc((size_t) hunkmax, sizeof(char *)); + p_line = malloc((size_t) hunkmax * sizeof(char *)); if (p_len == NULL) - p_len = calloc((size_t) hunkmax, sizeof(short)); + p_len = malloc((size_t) hunkmax * sizeof(short)); if (p_char == NULL) - p_char = calloc((size_t) hunkmax, sizeof(char)); + p_char = malloc((size_t) hunkmax * sizeof(char)); } /* @@ -155,17 +155,9 @@ grow_hunkmax(void) if (p_line == NULL || p_len == NULL || p_char == NULL) fatal("Internal memory allocation error\n"); - new_p_line = realloc(p_line, new_hunkmax * sizeof(char *)); - if (new_p_line == NULL) - free(p_line); - - new_p_len = realloc(p_len, new_hunkmax * sizeof(short)); - if (new_p_len == NULL) - free(p_len); - - new_p_char = realloc(p_char, new_hunkmax * sizeof(char)); - if (new_p_char == NULL) - free(p_char); + new_p_line = reallocf(p_line, new_hunkmax * sizeof(char *)); + new_p_len = reallocf(p_len, new_hunkmax * sizeof(short)); + new_p_char = reallocf(p_char, new_hunkmax * sizeof(char)); p_char = new_p_char; p_len = new_p_len; |