diff -Naur csh-20240808/Makefile csh-20240808.patched/Makefile --- csh-20240808/Makefile 2025-01-15 02:56:29.903448856 -0500 +++ csh-20240808.patched/Makefile 2025-01-15 02:57:32.900442927 -0500 @@ -8,7 +8,7 @@ SRCS= alloc.c char.c const.c csh.c dir.c dol.c error.c exec.c exp.c file.c \ func.c glob.c hist.c init.c lex.c misc.c parse.c proc.c \ sem.c set.c str.c time.c -LDADD+= -lbsd -lpub +LDADD+= -lbsd CLEANFILES+=error.h const.h diff -Naur csh-20240808/alloc.c csh-20240808.patched/alloc.c --- csh-20240808/alloc.c 2024-08-08 07:03:03.000000000 -0400 +++ csh-20240808.patched/alloc.c 2025-01-15 02:58:23.516438164 -0500 @@ -89,3 +89,16 @@ } return (n); } + +void * +xrealloc(void *p, size_t n) +{ + void *ptr; + + if ((ptr = realloc(p, n)) == NULL) { + child++; + stderror(ERR_NOMEM); + } + return (ptr); +} + diff -Naur csh-20240808/extern.h csh-20240808.patched/extern.h --- csh-20240808/extern.h 2024-08-08 07:03:03.000000000 -0400 +++ csh-20240808.patched/extern.h 2025-01-15 02:58:45.102436132 -0500 @@ -283,6 +283,7 @@ void *xreallocarray(void *, size_t, size_t); void *xcalloc(size_t, size_t); char *xstrdup(const char *); +void *xrealloc(void *p, size_t n); /* * str.c: diff -Naur csh-20240808/glob.c csh-20240808.patched/glob.c --- csh-20240808/glob.c 2025-01-15 02:56:29.916448854 -0500 +++ csh-20240808.patched/glob.c 2025-01-15 02:59:32.988431626 -0500 @@ -39,7 +39,6 @@ #include #include #include -#include #include "csh.h" #include "extern.h" @@ -456,7 +455,7 @@ * Output is empty, or none of the magic patterns matched. * It's up to the caller to generate a "No match" error. */ - xfree(nv); + if(nv) free(nv); return (NULL); } *nvp = NULL;