Skip to content

Commit 9488a27

Browse files
committed
ZendMM is infalliable, skip checks
1 parent aea69d2 commit 9488a27

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

win32/glob.c

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -597,8 +597,7 @@ static int glob0(const Char *pattern, glob_t *pglob, struct glob_lim *limitp)
597597
size_t n = pglob->gl_pathc - oldpathc;
598598
size_t o = pglob->gl_offs + oldpathc;
599599

600-
if ((path_stat = ecalloc(n, sizeof(*path_stat))) == NULL)
601-
return GLOB_NOSPACE;
600+
path_stat = ecalloc(n, sizeof(*path_stat));
602601
for (i = 0; i < n; i++) {
603602
path_stat[i].gps_path = pglob->gl_pathv[o + i];
604603
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,
841840
}
842841

843842
pathv = safe_erealloc_rel(pglob->gl_pathv, newn, sizeof(*pathv), 0);
844-
if (pathv == NULL)
845-
goto nospace;
846843
if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) {
847844
/* first time around -- clear initial gl_offs items */
848845
pathv += pglob->gl_offs;
@@ -871,9 +868,8 @@ static int globextend(const Char *path, glob_t *pglob, struct glob_lim *limitp,
871868
errno = 0;
872869
return(GLOB_NOSPACE);
873870
}
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));
877873
memcpy(statv[pglob->gl_offs + pglob->gl_pathc], sb,
878874
sizeof(*sb));
879875
}
@@ -884,13 +880,12 @@ static int globextend(const Char *path, glob_t *pglob, struct glob_lim *limitp,
884880
;
885881
len = (size_t)(p - path);
886882
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);
893887
}
888+
pathv[pglob->gl_offs + pglob->gl_pathc++] = copy;
894889
pathv[pglob->gl_offs + pglob->gl_pathc] = NULL;
895890

896891
if ((pglob->gl_flags & GLOB_LIMIT) &&

0 commit comments

Comments
 (0)