Skip to content

Commit 7bc29b0

Browse files
committed
ZendMM is infalliable, skip checks
1 parent 4195a4a commit 7bc29b0

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

main/php_glob.c

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -609,8 +609,7 @@ static int glob0(const Char *pattern, php_glob_t *pglob, struct glob_lim *limitp
609609
size_t n = pglob->gl_pathc - oldpathc;
610610
size_t o = pglob->gl_offs + oldpathc;
611611

612-
if ((path_stat = ecalloc(n, sizeof(*path_stat))) == NULL)
613-
return PHP_GLOB_NOSPACE;
612+
path_stat = ecalloc(n, sizeof(*path_stat));
614613
for (i = 0; i < n; i++) {
615614
path_stat[i].gps_path = pglob->gl_pathv[o + i];
616615
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
853852
}
854853

855854
pathv = safe_erealloc_rel(pglob->gl_pathv, newn, sizeof(*pathv), 0);
856-
if (pathv == NULL)
857-
goto nospace;
858855
if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) {
859856
/* first time around -- clear initial gl_offs items */
860857
pathv += pglob->gl_offs;
@@ -883,9 +880,8 @@ static int globextend(const Char *path, php_glob_t *pglob, struct glob_lim *limi
883880
errno = 0;
884881
return(PHP_GLOB_NOSPACE);
885882
}
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));
889885
memcpy(statv[pglob->gl_offs + pglob->gl_pathc], sb,
890886
sizeof(*sb));
891887
}
@@ -896,13 +892,12 @@ static int globextend(const Char *path, php_glob_t *pglob, struct glob_lim *limi
896892
;
897893
len = (size_t)(p - path);
898894
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);
905899
}
900+
pathv[pglob->gl_offs + pglob->gl_pathc++] = copy;
906901
pathv[pglob->gl_offs + pglob->gl_pathc] = NULL;
907902

908903
if ((pglob->gl_flags & PHP_GLOB_LIMIT) &&

0 commit comments

Comments
 (0)