@@ -609,8 +609,7 @@ static int glob0(const Char *pattern, php_glob_t *pglob, struct glob_lim *limitp
609
609
size_t n = pglob -> gl_pathc - oldpathc ;
610
610
size_t o = pglob -> gl_offs + oldpathc ;
611
611
612
- if ((path_stat = ecalloc (n , sizeof (* path_stat ))) == NULL )
613
- return PHP_GLOB_NOSPACE ;
612
+ path_stat = ecalloc (n , sizeof (* path_stat ));
614
613
for (i = 0 ; i < n ; i ++ ) {
615
614
path_stat [i ].gps_path = pglob -> gl_pathv [o + i ];
616
615
path_stat [i ].gps_stat = pglob -> gl_statv [o + i ];
@@ -853,8 +852,6 @@ static int globextend(const Char *path, php_glob_t *pglob, struct glob_lim *limi
853
852
}
854
853
855
854
pathv = safe_erealloc_rel (pglob -> gl_pathv , newn , sizeof (* pathv ), 0 );
856
- if (pathv == NULL )
857
- goto nospace ;
858
855
if (pglob -> gl_pathv == NULL && pglob -> gl_offs > 0 ) {
859
856
/* first time around -- clear initial gl_offs items */
860
857
pathv += pglob -> gl_offs ;
@@ -883,9 +880,8 @@ static int globextend(const Char *path, php_glob_t *pglob, struct glob_lim *limi
883
880
errno = 0 ;
884
881
return (PHP_GLOB_NOSPACE );
885
882
}
886
- if ((statv [pglob -> gl_offs + pglob -> gl_pathc ] =
887
- emalloc (sizeof (* * statv ))) == NULL )
888
- goto copy_error ;
883
+ statv [pglob -> gl_offs + pglob -> gl_pathc ] =
884
+ emalloc (sizeof (* * statv ));
889
885
memcpy (statv [pglob -> gl_offs + pglob -> gl_pathc ], sb ,
890
886
sizeof (* sb ));
891
887
}
@@ -896,13 +892,12 @@ static int globextend(const Char *path, php_glob_t *pglob, struct glob_lim *limi
896
892
;
897
893
len = (size_t )(p - path );
898
894
limitp -> glim_malloc += len ;
899
- if ((copy = emalloc (len )) != NULL ) {
900
- if (g_Ctoc (path , copy , len )) {
901
- efree (copy );
902
- return (PHP_GLOB_NOSPACE );
903
- }
904
- pathv [pglob -> gl_offs + pglob -> gl_pathc ++ ] = copy ;
895
+ copy = emalloc (len );
896
+ if (g_Ctoc (path , copy , len )) {
897
+ efree (copy );
898
+ return (PHP_GLOB_NOSPACE );
905
899
}
900
+ pathv [pglob -> gl_offs + pglob -> gl_pathc ++ ] = copy ;
906
901
pathv [pglob -> gl_offs + pglob -> gl_pathc ] = NULL ;
907
902
908
903
if ((pglob -> gl_flags & PHP_GLOB_LIMIT ) &&
0 commit comments