Skip to content

Commit 2bc7827

Browse files
committed
Fix NPE in UnsafeInMemorySorter.free()
1 parent 174e72c commit 2bc7827

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeInMemorySorter.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,10 @@ public UnsafeInMemorySorter(
111111
* Free the memory used by pointer array.
112112
*/
113113
public void free() {
114-
consumer.freeArray(array);
115-
array = null;
114+
if (consumer != null) {
115+
consumer.freeArray(array);
116+
array = null;
117+
}
116118
}
117119

118120
public void reset() {

0 commit comments

Comments
 (0)