diff options
| author | 2016-10-24 22:46:21 +1100 | |
|---|---|---|
| committer | 2016-10-24 22:46:21 +1100 | |
| commit | 27b58ac334b6d434ff8361800214f3e7c96d8a40 (patch) | |
| tree | 1059628ee9599fcb235113e7d20adebfdc221a57 /src/tools/imgtool/imgtool.cpp | |
| parent | 865dbe0357448e7fe0f59f72f56e77cc157354d2 (diff) | |
| parent | d167f6a5e15a6a153dcca872ca7588f8e41726c3 (diff) | |
Merge pull request #1543 from npwoods/imgtool_stream_open_smartpointer
[Imgtool] Changed imgtool::stream::open*() to return imgtool::stream::ptr
Diffstat (limited to 'src/tools/imgtool/imgtool.cpp')
| -rw-r--r-- | src/tools/imgtool/imgtool.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/tools/imgtool/imgtool.cpp b/src/tools/imgtool/imgtool.cpp index d82a1f7411a..d945ea3f82f 100644 --- a/src/tools/imgtool/imgtool.cpp +++ b/src/tools/imgtool/imgtool.cpp @@ -914,7 +914,7 @@ imgtoolerr_t imgtool::image::internal_open(const imgtool_module *module, const c } // open the stream - stream = imgtool::stream::ptr(imgtool::stream::open(fname, read_or_write)); + stream = imgtool::stream::open(fname, read_or_write); if (!stream) { err = (imgtoolerr_t)(IMGTOOLERR_FILENOTFOUND | IMGTOOLERR_SRC_IMAGEFILE); @@ -1871,7 +1871,7 @@ imgtoolerr_t imgtool::partition::get_file(const char *filename, const char *fork const char *dest, filter_getinfoproc filter) { imgtoolerr_t err; - imgtool::stream *f; + imgtool::stream::ptr f; char *new_fname = nullptr; char *alloc_dest = nullptr; const char *filter_extension = nullptr; @@ -1919,8 +1919,6 @@ imgtoolerr_t imgtool::partition::get_file(const char *filename, const char *fork goto done; done: - if (f != nullptr) - delete f; if (alloc_dest != nullptr) free(alloc_dest); if (new_fname != nullptr) @@ -1938,7 +1936,7 @@ imgtoolerr_t imgtool::partition::put_file(const char *newfname, const char *fork const char *source, util::option_resolution *opts, filter_getinfoproc filter) { imgtoolerr_t err; - imgtool::stream *f = nullptr; + imgtool::stream::ptr f; imgtool_charset charset; char *alloc_newfname = nullptr; std::string basename; @@ -1971,8 +1969,6 @@ imgtoolerr_t imgtool::partition::put_file(const char *newfname, const char *fork done: /* clean up */ - if (f != nullptr) - delete f; if (alloc_newfname != nullptr) osd_free(alloc_newfname); return err; |
