=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mg/extend.c,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- src/usr.bin/mg/extend.c 2002/09/15 14:48:50 1.29 +++ src/usr.bin/mg/extend.c 2003/09/22 23:03:07 1.30 @@ -1,4 +1,4 @@ -/* $OpenBSD: extend.c,v 1.29 2002/09/15 14:48:50 vincent Exp $ */ +/* $OpenBSD: extend.c,v 1.30 2003/09/22 23:03:07 vincent Exp $ */ /* * Extended (M-X) commands, rebinding, and startup file processing. @@ -91,7 +91,7 @@ ) { int i, n1, n2, nold; - KEYMAP *mp; + KEYMAP *mp, *newmap; PF *pfp; MAP_ELEMENT *mep; @@ -136,9 +136,11 @@ ele->k_base = c; ele->k_funcp = pfp; } else { - if (curmap->map_num >= curmap->map_max && - (curmap = reallocmap(curmap)) == NULL) - return FALSE; + if (curmap->map_num >= curmap->map_max) { + if ((newmap = reallocmap(curmap)) == NULL) + return FALSE; + curmap = newmap; + } if ((pfp = malloc(sizeof(PF))) == NULL) { ewprintf("Out of memory"); return FALSE;