Skip to content

Commit

Permalink
Merge pull request #65 from aws/affonsov/ad-638/memory-access-issue
Browse files Browse the repository at this point in the history
[AD-638] Memory errors
  • Loading branch information
Alexey Temnikov authored Apr 22, 2022
2 parents 79748e0 + e28cf82 commit 04a5135
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/linux-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ jobs:
chmod +x ./src/odbc-test/scripts/import_test_data.sh
./src/odbc-test/scripts/import_test_data.sh
# - name: run-tests
# run: |
# ssh -f -N -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ${{env.DOC_DB_PRIV_KEY_FILE}} -L${{env.DOC_DB_LOCAL_PORT}}:${{secrets.DOC_DB_HOST}}:${{env.DOC_DB_REMOTE_PORT}} ${{secrets.DOC_DB_USER}}
# ./build/odbc/bin/ignite-odbc-tests
- name: run-tests
run: |
ssh -f -N -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ${{env.DOC_DB_PRIV_KEY_FILE}} -L${{env.DOC_DB_LOCAL_PORT}}:${{secrets.DOC_DB_HOST}}:${{env.DOC_DB_REMOTE_PORT}} ${{secrets.DOC_DB_USER}}
./build/odbc/bin/ignite-odbc-tests --catch_system_errors=false
- name: upload-test-report
if: always()
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/mac-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ jobs:
run: |
chmod +x ./src/odbc-test/scripts/import_test_data.sh
./src/odbc-test/scripts/import_test_data.sh
# - name: run-tests
# run: |
# ssh -f -N -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ${{env.DOC_DB_PRIV_KEY_FILE}} -L${{env.DOC_DB_LOCAL_PORT}}:${{secrets.DOC_DB_HOST}}:${{env.DOC_DB_REMOTE_PORT}} ${{secrets.DOC_DB_USER}}
# ./build/odbc/bin/ignite-odbc-tests
- name: run-tests
run: |
ssh -f -N -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ${{env.DOC_DB_PRIV_KEY_FILE}} -L${{env.DOC_DB_LOCAL_PORT}}:${{secrets.DOC_DB_HOST}}:${{env.DOC_DB_REMOTE_PORT}} ${{secrets.DOC_DB_USER}}
./build/odbc/bin/ignite-odbc-tests --catch_system_errors=false
- name: upload-test-report
if: always()
uses: EnricoMi/publish-unit-test-result-action/[email protected]
Expand Down
15 changes: 15 additions & 0 deletions src/odbc/src/jni/java.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,7 @@ JniErrorCode JniContext::DriverManagerGetConnection(
} else {
connection = new GlobalJObject(env, env->NewGlobalRef(result));
}
env->DeleteLocalRef(jConnectionString);
return errInfo.code;
}

Expand Down Expand Up @@ -1148,6 +1149,10 @@ JniErrorCode JniContext::DatabaseMetaDataGetTables(
jvm->GetMembers().m_DatabaseMetaDataGetTables, jCatalog, jSchemaPattern,
jTableNamePattern, jTypes);
ExceptionCheck(env, &errInfo);
env->DeleteLocalRef(jCatalog);
env->DeleteLocalRef(jSchemaPattern);
env->DeleteLocalRef(jTableNamePattern);
env->DeleteLocalRef(jTypes);

if (!result || errInfo.code != JniErrorCode::IGNITE_JNI_ERR_SUCCESS) {
resultSet = nullptr;
Expand Down Expand Up @@ -1181,6 +1186,11 @@ JniErrorCode JniContext::DatabaseMetaDataGetColumns(
jTableNamePattern, jColumnNamePattern);
ExceptionCheck(env, &errInfo);

env->DeleteLocalRef(jCatalog);
env->DeleteLocalRef(jSchemaPattern);
env->DeleteLocalRef(jTableNamePattern);
env->DeleteLocalRef(jColumnNamePattern);

if (!result || errInfo.code != JniErrorCode::IGNITE_JNI_ERR_SUCCESS) {
resultSet = nullptr;
return errInfo.code;
Expand Down Expand Up @@ -1268,6 +1278,8 @@ JniErrorCode JniContext::ResultSetGetString(
resultSet.Get()->GetRef(), jvm->GetMembers().m_ResultSetGetStringByName,
jColumnName);
ExceptionCheck(env, &errInfo);

env->DeleteLocalRef(jColumnName);

if (errInfo.code == JniErrorCode::IGNITE_JNI_ERR_SUCCESS) {
if (result != nullptr) {
Expand Down Expand Up @@ -1324,6 +1336,9 @@ JniErrorCode JniContext::ResultSetGetInt(
jvm->GetMembers().m_ResultSetGetIntByName,
jColumnName);
ExceptionCheck(env, &errInfo);

env->DeleteLocalRef(jColumnName);

if (errInfo.code == JniErrorCode::IGNITE_JNI_ERR_SUCCESS) {
bool wasNull;
errInfo.code = ResultSetWasNull(resultSet, wasNull, errInfo);
Expand Down

0 comments on commit 04a5135

Please sign in to comment.