Skip to content
Snippets Groups Projects
Unverified Commit 679311c8 authored by Richard Cordovano's avatar Richard Cordovano Committed by GitHub
Browse files

Merge pull request #1239 from sleuthkit/vol_free_fix

Volume.close should not call the VolumeSystem close method
parents 098b0c71 dca4590a
Branches Fix_tests
No related tags found
No related merge requests found
...@@ -884,7 +884,12 @@ public static void closeImg(long imgHandle) { ...@@ -884,7 +884,12 @@ public static void closeImg(long imgHandle) {
* @param vsHandle pointer to volume system structure in sleuthkit * @param vsHandle pointer to volume system structure in sleuthkit
*/ */
public static void closeVs(long vsHandle) { public static void closeVs(long vsHandle) {
closeVsNat(vsHandle); // NOTE: We are not caching Volume System handles, so we
// can free it. One is allocated per VolumeSystem object.
// There is a chance that a vsPart handle exists in a Volume object,
// and that memory will be freed. But, the "TAG" checks in the native
// code should detect that it has been freed.
closeVsNat(vsHandle);
} }
/** /**
......
...@@ -79,14 +79,9 @@ public int read(byte[] buf, long offset, long len) throws TskCoreException { ...@@ -79,14 +79,9 @@ public int read(byte[] buf, long offset, long len) throws TskCoreException {
@Override @Override
public void close() { public void close() {
if (volumeHandle != 0) { // there is nothing to free. The VolumeSystem structure
synchronized (this) { // in C++ contains this structure and will free it.
if (volumeHandle != 0) { volumeHandle = 0;
SleuthkitJNI.closeVs(volumeHandle);
volumeHandle = 0;
}
}
}
} }
@Override @Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment