Skip to content

Commit 7020e6f

Browse files
committed
fix leak
1 parent 0a50cba commit 7020e6f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

win32/ioutil.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,7 @@ PW32IO size_t php_win32_ioutil_dirname(char *path, size_t len)
467467
endw--;
468468
}
469469
if (endw < pathw) {
470+
free(startw);
470471
/* The path only contained slashes */
471472
path[0] = PHP_WIN32_IOUTIL_DEFAULT_SLASH;
472473
path[1] = '\0';
@@ -478,6 +479,7 @@ PW32IO size_t php_win32_ioutil_dirname(char *path, size_t len)
478479
endw--;
479480
}
480481
if (endw < pathw) {
482+
free(startw);
481483
path[0] = '.';
482484
path[1] = '\0';
483485
return 1 + len_adjust;
@@ -488,6 +490,7 @@ PW32IO size_t php_win32_ioutil_dirname(char *path, size_t len)
488490
endw--;
489491
}
490492
if (endw < pathw) {
493+
free(startw);
491494
path[0] = PHP_WIN32_IOUTIL_DEFAULT_SLASH;
492495
path[1] = '\0';
493496
return 1 + len_adjust;

0 commit comments

Comments
 (0)