diff options
| author | Eli Zaretskii | 2019-03-23 10:31:06 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2019-03-23 10:31:06 +0200 |
| commit | 86c3cd99bff27e35e25dec0ee3f0dc4536b171ea (patch) | |
| tree | 57b1d1f6e8a2ddceea6d8f6329b13b5f0a338777 /src/w32proc.c | |
| parent | 068cbed32abfeb4e141cd5f56dedb084539ac7b7 (diff) | |
| download | emacs-86c3cd99bff27e35e25dec0ee3f0dc4536b171ea.tar.gz emacs-86c3cd99bff27e35e25dec0ee3f0dc4536b171ea.zip | |
Avoid compiler warning in w32proc.c
* src/w32proc.c (w32_executable_type): Avoid compiler warnings
about potential NULL pointer dereferencing.
Diffstat (limited to 'src/w32proc.c')
| -rw-r--r-- | src/w32proc.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/w32proc.c b/src/w32proc.c index 8e878e6ef3e..75e345a525a 100644 --- a/src/w32proc.c +++ b/src/w32proc.c | |||
| @@ -1776,22 +1776,27 @@ w32_executable_type (char * filename, | |||
| 1776 | if (data_dir) | 1776 | if (data_dir) |
| 1777 | { | 1777 | { |
| 1778 | /* Look for Cygwin DLL in the DLL import list. */ | 1778 | /* Look for Cygwin DLL in the DLL import list. */ |
| 1779 | IMAGE_DATA_DIRECTORY import_dir = | 1779 | IMAGE_DATA_DIRECTORY import_dir |
| 1780 | data_dir[IMAGE_DIRECTORY_ENTRY_IMPORT]; | 1780 | = data_dir[IMAGE_DIRECTORY_ENTRY_IMPORT]; |
| 1781 | 1781 | ||
| 1782 | /* Import directory can be missing in .NET DLLs. */ | 1782 | /* Import directory can be missing in .NET DLLs. */ |
| 1783 | if (import_dir.VirtualAddress != 0) | 1783 | if (import_dir.VirtualAddress != 0) |
| 1784 | { | 1784 | { |
| 1785 | IMAGE_SECTION_HEADER *section | ||
| 1786 | = rva_to_section (import_dir.VirtualAddress, nt_header); | ||
| 1787 | if (!section) | ||
| 1788 | emacs_abort (); | ||
| 1789 | |||
| 1785 | IMAGE_IMPORT_DESCRIPTOR * imports = | 1790 | IMAGE_IMPORT_DESCRIPTOR * imports = |
| 1786 | RVA_TO_PTR (import_dir.VirtualAddress, | 1791 | RVA_TO_PTR (import_dir.VirtualAddress, section, |
| 1787 | rva_to_section (import_dir.VirtualAddress, | ||
| 1788 | nt_header), | ||
| 1789 | executable); | 1792 | executable); |
| 1790 | 1793 | ||
| 1791 | for ( ; imports->Name; imports++) | 1794 | for ( ; imports->Name; imports++) |
| 1792 | { | 1795 | { |
| 1793 | IMAGE_SECTION_HEADER * section = | 1796 | section = rva_to_section (imports->Name, nt_header); |
| 1794 | rva_to_section (imports->Name, nt_header); | 1797 | if (!section) |
| 1798 | emacs_abort (); | ||
| 1799 | |||
| 1795 | char * dllname = RVA_TO_PTR (imports->Name, section, | 1800 | char * dllname = RVA_TO_PTR (imports->Name, section, |
| 1796 | executable); | 1801 | executable); |
| 1797 | 1802 | ||