[PATCH] avoid malloc(0) for AIX
Fabian Groffen <[email protected]>
| Newsgroups | gmane.comp.gnu.utils.bugs |
|---|---|
| Organization | Gentoo Foundation, Inc. |
| Message-ID | <[email protected]> |
On AIX, malloc(0) segfaults, hence avoid calling malloc(0).
--- sed-4.2.1/lib/regex_internal.c
+++ sed-4.2.1/lib/regex_internal.c
@@ -883,6 +883,9 @@
re_node_set *set;
int size;
{
+ if ( size == 0 )
+ return REG_NOERROR;
+
set->alloc = size;
set->nelem = 0;
set->elems = re_malloc (int, size);
--
Fabian Groffen
Gentoo on a different level
signature.asc
(application/pgp-signature, 195 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (Darwin) iEYEARECAAYFAk6lqmAACgkQX3X2B8XHTokPewCgn/ys15hVYRGCozfetdTD3k/a 9ekAnj2aP65WGCYYhOzKWXHnL0xy33WV =7RxA -----END PGP SIGNATURE-----