summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2019-08-15 20:47:23 +0000
committerStefan Schmidt <s.schmidt@samsung.com>2019-08-16 09:30:54 +0200
commit289cd1f3d499f3f587bed2954dc5d878f75e0c68 (patch)
tree65eb3818fb99dd25913bc9a212ae3cac50863250
parentf5063b8733b0081e689894ba27a727549cb48321 (diff)
eolian-cxx: Fix use after free for base variable
T8137 Differential Revision: https://phab.enlightenment.org/D9575
-rw-r--r--src/bin/eolian_cxx/eolian_cxx.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/bin/eolian_cxx/eolian_cxx.cc b/src/bin/eolian_cxx/eolian_cxx.cc
index 1e0842873d..6f719f178f 100644
--- a/src/bin/eolian_cxx/eolian_cxx.cc
+++ b/src/bin/eolian_cxx/eolian_cxx.cc
@@ -287,10 +287,10 @@ run(options_type const& opts)
287 { 287 {
288 const Eolian_Class *klass = nullptr; 288 const Eolian_Class *klass = nullptr;
289 char* dup = strdup(opts.in_files[0].c_str()); 289 char* dup = strdup(opts.in_files[0].c_str());
290 char* base = basename(dup); 290 std::string base (basename(dup));
291 std::string cpp_types_header; 291 std::string cpp_types_header;
292 opts.unit = (Eolian_Unit*)opts.state; 292 opts.unit = (Eolian_Unit*)opts.state;
293 klass = ::eolian_state_class_by_file_get(opts.state, base); 293 klass = ::eolian_state_class_by_file_get(opts.state, base.c_str());
294 free(dup); 294 free(dup);
295 if (klass) 295 if (klass)
296 { 296 {
@@ -346,8 +346,8 @@ run(options_type const& opts)
346 opts.unit = unit; 346 opts.unit = unit;
347 } 347 }
348 char* dup = strdup(name.c_str()); 348 char* dup = strdup(name.c_str());
349 char* base = basename(dup); 349 std::string base(basename(dup));
350 Eolian_Class const* klass = ::eolian_state_class_by_file_get(opts.state, base); 350 Eolian_Class const* klass = ::eolian_state_class_by_file_get(opts.state, base.c_str());
351 free(dup); 351 free(dup);
352 if (klass) 352 if (klass)
353 { 353 {