src/mess/tools/imgtool/imgtool.c
| r7861 | r7862 | |
| 1474 | 1474 | if (alloc_path != NULL) |
| 1475 | 1475 | free(alloc_path); |
| 1476 | 1476 | if (new_fname != NULL) |
| 1477 | | free(new_fname); |
| 1477 | osd_free(new_fname); |
| 1478 | 1478 | return err; |
| 1479 | 1479 | } |
| 1480 | 1480 | |
| r7861 | r7862 | |
| 1519 | 1519 | if (alloc_path != NULL) |
| 1520 | 1520 | free(alloc_path); |
| 1521 | 1521 | if (new_fname != NULL) |
| 1522 | | free(new_fname); |
| 1522 | osd_free(new_fname); |
| 1523 | 1523 | return err; |
| 1524 | 1524 | } |
| 1525 | 1525 | |
| r7861 | r7862 | |
| 1628 | 1628 | if (alloc_path) |
| 1629 | 1629 | free(alloc_path); |
| 1630 | 1630 | if (new_fname) |
| 1631 | | free(new_fname); |
| 1631 | osd_free(new_fname); |
| 1632 | 1632 | return err; |
| 1633 | 1633 | } |
| 1634 | 1634 | |
| r7861 | r7862 | |
| 1847 | 1847 | imgtoolerr_t imgtool_partition_read_file(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf, filter_getinfoproc filter) |
| 1848 | 1848 | { |
| 1849 | 1849 | imgtoolerr_t err; |
| 1850 | | imgtool_stream *newstream = NULL; |
| 1851 | 1850 | char *alloc_path = NULL; |
| 1852 | 1851 | union filterinfo u; |
| 1853 | 1852 | |
| r7861 | r7862 | |
| 1895 | 1894 | } |
| 1896 | 1895 | |
| 1897 | 1896 | done: |
| 1898 | | if (newstream) |
| 1899 | | stream_close(newstream); |
| 1900 | 1897 | if (alloc_path) |
| 1901 | 1898 | free(alloc_path); |
| 1902 | 1899 | return err; |
| r7861 | r7862 | |
| 1914 | 1911 | imgtoolerr_t err; |
| 1915 | 1912 | char *buf = NULL; |
| 1916 | 1913 | char *s; |
| 1917 | | imgtool_stream *newstream = NULL; |
| 1918 | 1914 | option_resolution *alloc_resolution = NULL; |
| 1919 | 1915 | char *alloc_path = NULL; |
| 1920 | 1916 | UINT64 free_space; |
| r7861 | r7862 | |
| 2017 | 2013 | free(buf); |
| 2018 | 2014 | if (alloc_path) |
| 2019 | 2015 | free(alloc_path); |
| 2020 | | if (newstream) |
| 2021 | | stream_close(newstream); |
| 2022 | 2016 | if (alloc_resolution) |
| 2023 | 2017 | option_resolution_close(alloc_resolution); |
| 2024 | 2018 | return err; |
| r7861 | r7862 | |
| 2078 | 2072 | goto done; |
| 2079 | 2073 | } |
| 2080 | 2074 | |
| 2081 | | filename = new_fname; |
| 2082 | | |
| 2083 | | err = imgtool_partition_read_file(partition, filename, fork, f, filter); |
| 2075 | err = imgtool_partition_read_file(partition, new_fname, fork, f, filter); |
| 2084 | 2076 | if (err) |
| 2085 | 2077 | goto done; |
| 2086 | 2078 | |
| r7861 | r7862 | |
| 2090 | 2082 | if (alloc_dest != NULL) |
| 2091 | 2083 | free(alloc_dest); |
| 2092 | 2084 | if (new_fname != NULL) |
| 2093 | | free(new_fname); |
| 2085 | osd_free(new_fname); |
| 2094 | 2086 | return err; |
| 2095 | 2087 | } |
| 2096 | 2088 | |
| r7861 | r7862 | |
| 2137 | 2129 | if (f != NULL) |
| 2138 | 2130 | stream_close(f); |
| 2139 | 2131 | if (alloc_newfname != NULL) |
| 2140 | | free(alloc_newfname); |
| 2132 | osd_free(alloc_newfname); |
| 2141 | 2133 | return err; |
| 2142 | 2134 | } |
| 2143 | 2135 | |
| r7861 | r7862 | |
| 2185 | 2177 | if (alloc_path) |
| 2186 | 2178 | free(alloc_path); |
| 2187 | 2179 | if (new_fname) |
| 2188 | | free(new_fname); |
| 2180 | osd_free(new_fname); |
| 2189 | 2181 | return err; |
| 2190 | 2182 | } |
| 2191 | 2183 | |
| r7861 | r7862 | |
| 2230 | 2222 | if (alloc_path) |
| 2231 | 2223 | free(alloc_path); |
| 2232 | 2224 | if (new_fname) |
| 2233 | | free(new_fname); |
| 2225 | osd_free(new_fname); |
| 2234 | 2226 | return err; |
| 2235 | 2227 | } |
| 2236 | 2228 | |
| r7861 | r7862 | |
| 2276 | 2268 | if (alloc_path) |
| 2277 | 2269 | free(alloc_path); |
| 2278 | 2270 | if (new_path) |
| 2279 | | free(new_path); |
| 2271 | osd_free(new_path); |
| 2280 | 2272 | return err; |
| 2281 | 2273 | } |
| 2282 | 2274 | |
| r7861 | r7862 | |
| 2322 | 2314 | if (alloc_path) |
| 2323 | 2315 | free(alloc_path); |
| 2324 | 2316 | if (new_path) |
| 2325 | | free(new_path); |
| 2317 | osd_free(new_path); |
| 2326 | 2318 | return err; |
| 2327 | 2319 | } |
| 2328 | 2320 | |
| r7861 | r7862 | |
| 2631 | 2623 | if (alloc_path != NULL) |
| 2632 | 2624 | free(alloc_path); |
| 2633 | 2625 | if (new_path != NULL) |
| 2634 | | free(new_path); |
| 2626 | osd_free(new_path); |
| 2635 | 2627 | if (err && (enumeration != NULL)) |
| 2636 | 2628 | { |
| 2637 | 2629 | free(enumeration); |
| r7861 | r7862 | |
| 2690 | 2682 | return IMGTOOLERR_BADFILENAME; |
| 2691 | 2683 | |
| 2692 | 2684 | strcpy(ent->filename, new_fname); |
| 2693 | | free(new_fname); |
| 2685 | osd_free(new_fname); |
| 2694 | 2686 | } |
| 2695 | 2687 | |
| 2696 | 2688 | /* don't trust the module! */ |