Mercurial > vim
comparison src/filepath.c @ 18947:d6c7b2f9aa20 v8.2.0034
patch 8.2.0034: missing check for out of memory
Commit: https://github.com/vim/vim/commit/70188f5b23ea7efec7adaf74e0af797d1bb1afe8
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Dec 23 18:18:52 2019 +0100
patch 8.2.0034: missing check for out of memory
Problem: Missing check for out of memory.
Solution: Check for NULL after vim_strsave(). (Dominique Pelle,
closes #5393)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 23 Dec 2019 18:30:04 +0100 |
parents | 410155e75efa |
children | 94eda51ba9ba |
comparison
equal
deleted
inserted
replaced
18946:59c8d375c1ec | 18947:d6c7b2f9aa20 |
---|---|
1656 int is_relative_to_current = FALSE; | 1656 int is_relative_to_current = FALSE; |
1657 int has_trailing_pathsep = FALSE; | 1657 int has_trailing_pathsep = FALSE; |
1658 int limit = 100; | 1658 int limit = 100; |
1659 | 1659 |
1660 p = vim_strsave(p); | 1660 p = vim_strsave(p); |
1661 | 1661 if (p == NULL) |
1662 goto fail; | |
1662 if (p[0] == '.' && (vim_ispathsep(p[1]) | 1663 if (p[0] == '.' && (vim_ispathsep(p[1]) |
1663 || (p[1] == '.' && (vim_ispathsep(p[2]))))) | 1664 || (p[1] == '.' && (vim_ispathsep(p[2]))))) |
1664 is_relative_to_current = TRUE; | 1665 is_relative_to_current = TRUE; |
1665 | 1666 |
1666 len = STRLEN(p); | 1667 len = STRLEN(p); |
1679 q[-1] = NUL; | 1680 q[-1] = NUL; |
1680 } | 1681 } |
1681 | 1682 |
1682 buf = alloc(MAXPATHL + 1); | 1683 buf = alloc(MAXPATHL + 1); |
1683 if (buf == NULL) | 1684 if (buf == NULL) |
1685 { | |
1686 vim_free(p); | |
1684 goto fail; | 1687 goto fail; |
1688 } | |
1685 | 1689 |
1686 for (;;) | 1690 for (;;) |
1687 { | 1691 { |
1688 for (;;) | 1692 for (;;) |
1689 { | 1693 { |