X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fconfig%2Fconfig.cpp;fp=src%2Fconfig%2Fconfig.cpp;h=9d7776d8f0a725fa7ba74f729261627276a7c2cc;hb=23d0e614733c0305738d8c70d2e4c3e56beb6473;hp=21b9e651c6ec7b93c297f5a039ab1c7aa18718c3;hpb=c7e5ea3aedd61576a66497e9aa16ec5421466de2;p=ric-plt%2Fxapp-frame-cpp.git diff --git a/src/config/config.cpp b/src/config/config.cpp index 21b9e65..9d7776d 100644 --- a/src/config/config.cpp +++ b/src/config/config.cpp @@ -91,13 +91,13 @@ void xapp::Config::Listener( ) { *tok = 0; bname = strdup( tok+1 ); } else { - free( dname ); + delete dname; dname = strdup( "." ); bname = strdup( fname.c_str() ); } wfd = inotify_add_watch( ifd, dname, IN_MOVED_TO | IN_CLOSE_WRITE ); // we only care about close write changes - free( dname ); + delete dname; if( wfd < 0 ) { fprintf( stderr, " ### ERR ### unable to add watch on config file %s: %s\n", fname.c_str(), strerror( errno ) ); @@ -263,12 +263,10 @@ std::string xapp::Config::Get_control_str( const std::string& name, const std::s } jh->Unset_blob(); - if( jh->Set_blob( (const char *) "controls" ) ) { - if( jh->Exists( name.c_str() ) ) { - value = jh->String( name.c_str() ); - if( value.compare( "" ) != 0 ) { - rv = value; - } + if( jh->Set_blob( (const char *) "controls" ) && jh->Exists( name.c_str() ) ) { + value = jh->String( name.c_str() ); + if( value.compare( "" ) != 0 ) { + rv = value; } }