@@ -597,8 +597,7 @@ static int glob0(const Char *pattern, glob_t *pglob, struct glob_lim *limitp)
597
597
size_t n = pglob -> gl_pathc - oldpathc ;
598
598
size_t o = pglob -> gl_offs + oldpathc ;
599
599
600
- if ((path_stat = ecalloc (n , sizeof (* path_stat ))) == NULL )
601
- return GLOB_NOSPACE ;
600
+ path_stat = ecalloc (n , sizeof (* path_stat ));
602
601
for (i = 0 ; i < n ; i ++ ) {
603
602
path_stat [i ].gps_path = pglob -> gl_pathv [o + i ];
604
603
path_stat [i ].gps_stat = pglob -> gl_statv [o + i ];
@@ -841,8 +840,6 @@ static int globextend(const Char *path, glob_t *pglob, struct glob_lim *limitp,
841
840
}
842
841
843
842
pathv = safe_erealloc_rel (pglob -> gl_pathv , newn , sizeof (* pathv ), 0 );
844
- if (pathv == NULL )
845
- goto nospace ;
846
843
if (pglob -> gl_pathv == NULL && pglob -> gl_offs > 0 ) {
847
844
/* first time around -- clear initial gl_offs items */
848
845
pathv += pglob -> gl_offs ;
@@ -871,9 +868,8 @@ static int globextend(const Char *path, glob_t *pglob, struct glob_lim *limitp,
871
868
errno = 0 ;
872
869
return (GLOB_NOSPACE );
873
870
}
874
- if ((statv [pglob -> gl_offs + pglob -> gl_pathc ] =
875
- emalloc (sizeof (* * statv ))) == NULL )
876
- goto copy_error ;
871
+ statv [pglob -> gl_offs + pglob -> gl_pathc ] =
872
+ emalloc (sizeof (* * statv ));
877
873
memcpy (statv [pglob -> gl_offs + pglob -> gl_pathc ], sb ,
878
874
sizeof (* sb ));
879
875
}
@@ -884,13 +880,12 @@ static int globextend(const Char *path, glob_t *pglob, struct glob_lim *limitp,
884
880
;
885
881
len = (size_t )(p - path );
886
882
limitp -> glim_malloc += len ;
887
- if ((copy = emalloc (len )) != NULL ) {
888
- if (g_Ctoc (path , copy , len )) {
889
- efree (copy );
890
- return (GLOB_NOSPACE );
891
- }
892
- pathv [pglob -> gl_offs + pglob -> gl_pathc ++ ] = copy ;
883
+ copy = emalloc (len );
884
+ if (g_Ctoc (path , copy , len )) {
885
+ efree (copy );
886
+ return (GLOB_NOSPACE );
893
887
}
888
+ pathv [pglob -> gl_offs + pglob -> gl_pathc ++ ] = copy ;
894
889
pathv [pglob -> gl_offs + pglob -> gl_pathc ] = NULL ;
895
890
896
891
if ((pglob -> gl_flags & GLOB_LIMIT ) &&
0 commit comments