diff options
| author | bloodstalker <thabogre@gmail.com> | 2017-05-15 15:49:21 +0000 | 
|---|---|---|
| committer | bloodstalker <thabogre@gmail.com> | 2017-05-15 15:49:21 +0000 | 
| commit | dc277003a2f2e5e0090b1c6a325cbfb7c68cec11 (patch) | |
| tree | 86724b7392966a8ca79014291b1dd29c8fcb70bb | |
| parent | chaned some macros to fix the color problem (diff) | |
| download | mutator-dc277003a2f2e5e0090b1c6a325cbfb7c68cec11.tar.gz mutator-dc277003a2f2e5e0090b1c6a325cbfb7c68cec11.zip | |
the memory leak is apparently a non-issue, for more info read the comment in the source code for it
| -rw-r--r-- | bruiser/CompletionHints.cpp | 15 | 
1 files changed, 9 insertions, 6 deletions
| diff --git a/bruiser/CompletionHints.cpp b/bruiser/CompletionHints.cpp index ed0eb2e..43f4345 100644 --- a/bruiser/CompletionHints.cpp +++ b/bruiser/CompletionHints.cpp @@ -63,15 +63,17 @@ namespace bruiser            break;          } -        if (iter.find(dummy) == 0U) +        if (iter.find(__buf) == 0U)          {            *__color = 35; -          *__bold = 0; +          *__bold = 1;            int sizet = dummy.length(); -          std::string dummy2 = iter.substr(sizet, iter.length() - sizet + 1); +          std::string dummy2 = iter.substr(sizet, std::string::npos); -          /*LEAKS MEMORY*/ +          /*@DEVI-apparently linenoise expects the return value to live past the hints callback function returning,  +           * i mean that's why our vector version returns junk. linenoise later frees the returned hint so there  +           * should be no leaked memory(it calls freeHintsCallback).*/            char* returnchar = new char[dummy2.size() + 1];            std::copy(dummy2.begin(), dummy2.end(), returnchar);            returnchar[dummy2.size()] = '\0'; @@ -81,12 +83,13 @@ namespace bruiser            retchar.push_back('\0');            //std::cout << "\n" << retchar.data() << "\n";            char* c = (char*)retchar.data(); -          //std::cout << "\n" << c << "\n"; +          std::cout << "\n" << c << "\n";  #endif            return returnchar;            //return c; -          //return &*retchar.data(); +          //return retchar.data(); +          //return &retchar[0];          }        }      } | 
