Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix several resource leaks #1435

Merged
merged 5 commits into from
May 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion dyninstAPI/src/parse-power.C
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ std::string parse_func::calcParentFunc(const parse_func * imf,
/* We need to figure out the function that called the outlined
parallel region function. We do this by chopping off the
last @OL@number */
const char * nameStart = imf->prettyName().c_str();
auto const& tmp = imf->prettyName();
const char * nameStart = tmp.c_str();
const char * nameEnd = strrchr(nameStart, '@');
int strSize = nameEnd - nameStart - 3;

Expand Down
3 changes: 2 additions & 1 deletion dyninstAPI/src/unix.C
Original file line number Diff line number Diff line change
Expand Up @@ -530,11 +530,12 @@ bool PCProcess::hasPassedMain()
bool PCProcess::startDebugger() {
std::stringstream pidStr;
pidStr << getPid();
auto tmp = pidStr.str();

const char *args[4];
args[0] = dyn_debug_crash_debugger;
args[1] = file_.c_str();
args[2] = pidStr.str().c_str();
args[2] = tmp.c_str();
args[3] = NULL;

proccontrol_printf("%s[%d]: Launching %s %s %s\n", FILE__, __LINE__,
Expand Down
1 change: 1 addition & 0 deletions proccontrol/src/irpc.C
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ void int_iRPC::setBinarySize(unsigned long s)

void int_iRPC::copyBinaryBlob(void *b, unsigned long s)
{
if(binary_blob && freeBinaryBlob) free(binary_blob);
binary_blob = malloc(s);
assert(binary_blob);
binary_size = s;
Expand Down
4 changes: 1 addition & 3 deletions proccontrol/src/memcache.C
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,7 @@ async_ret_t memCache::doOperation(memEntry *me, int_thread *op_thread)
return aret_error;
}

memEntry *me_copy = new memEntry(me, me->buffer);

mem_cache.push_back(me_copy);
mem_cache.push_back(new memEntry(me, me->buffer));
last_operation = mem_cache.end();
last_operation--;

Expand Down
6 changes: 3 additions & 3 deletions symtabAPI/src/Symtab-edit.C
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,15 @@ bool Symtab::addSymbol(Symbol *newSym, Symbol *referringSymbol)
newSym->setReferringSymbol(referringSymbol);

string filename = referringSymbol->getModule()->exec()->name();
vector<string> *vers, *newSymVers = new vector<string>;
vector<string> *vers{};
newSym->setVersionFileName(filename);
std::string rstr;

newSym->getVersionFileName(rstr);
if (referringSymbol->getVersions(vers) && vers != NULL && vers->size() > 0)
{
newSymVers->push_back((*vers)[0]);
newSym->setVersions(*newSymVers);
auto newSymVers = std::vector<std::string>{(*vers)[0]};
newSym->setVersions(newSymVers);
}
}else{
newSym->setReferringSymbol(referringSymbol);
Expand Down