Changeset: 548949530646 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=548949530646 Modified Files: monetdb5/mal/mal_authorize.c monetdb5/modules/mal/remote.c Branch: remote_auth Log Message:
Fix memory leaks found by sanitizer diffs (52 lines): diff --git a/monetdb5/mal/mal_authorize.c b/monetdb5/mal/mal_authorize.c --- a/monetdb5/mal/mal_authorize.c +++ b/monetdb5/mal/mal_authorize.c @@ -1026,7 +1026,7 @@ AUTHgetRemoteTableCredentials(const char tmp = BUNtail(i, p); rethrow("getRemoteTableCredentials", tmp, AUTHdecypherValue(&pwhash, tmp)); - *password = GDKstrdup(pwhash); + *password = pwhash; return MAL_SUCCEED; } @@ -1087,6 +1087,10 @@ AUTHaddRemoteTableCredentials(const char if (free_pw) { free(pwhash); } + else { + GDKfree(pwhash); + } + GDKfree(cypher); throw(MAL, "addRemoteTableCredentials", SQLSTATE(HY001) MAL_MALLOC_FAIL); } @@ -1095,6 +1099,10 @@ AUTHaddRemoteTableCredentials(const char if (free_pw) { free(pwhash); } + else { + GDKfree(pwhash); + } + GDKfree(cypher); return MAL_SUCCEED; } diff --git a/monetdb5/modules/mal/remote.c b/monetdb5/modules/mal/remote.c --- a/monetdb5/modules/mal/remote.c +++ b/monetdb5/modules/mal/remote.c @@ -300,10 +300,13 @@ RMTconnectTable(Client cntxt, MalBlkPtr if (msg == MAL_SUCCEED) { v = &stk->stk[pci->argv[0]]; v->vtype = TYPE_str; - if((v->val.sval = GDKstrdup(ret)) == NULL) + if((v->val.sval = GDKstrdup(ret)) == NULL) { + GDKfree(ret); throw(MAL, "remote.connect", SQLSTATE(HY001) MAL_MALLOC_FAIL); + } } + GDKfree(ret); return msg; } _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list