[
https://issues.apache.org/jira/browse/HDFS-17921?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18081554#comment-18081554
]
ASF GitHub Bot commented on HDFS-17921:
---------------------------------------
ZanderXu commented on code in PR #8498:
URL: https://github.com/apache/hadoop/pull/8498#discussion_r3256021613
##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/erasurecode/StripedBlockWriter.java:
##########
@@ -151,6 +151,7 @@ private void init() throws IOException {
success = true;
} finally {
if (!success) {
+ stripedWriter.getReconstructor().freeBuffer(targetBuffer);
Review Comment:
Nice catch.
```
stripedWriter.getReconstructor().freeBuffer(targetBuffer);
targetBuffer = null;
```
So how about change the method `freeTargetBuffer()` to
```
void freeTargetBuffer() {
if (targetBuffer != null) {
stripedWriter.getReconstructor().freeBuffer(targetBuffer);
targetBuffer = null;
}
}
```
And change the caller of the `freeTargetBuffer()`
> StripedBlockWriter should free up buffer if init fails
> ------------------------------------------------------
>
> Key: HDFS-17921
> URL: https://issues.apache.org/jira/browse/HDFS-17921
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: hdfs
> Reporter: Felix N
> Assignee: Felix N
> Priority: Trivial
> Labels: pull-request-available
>
> StripedBlockWriter allocates targetBuffer before calling init() so
> StripedBlockWriter should free up targetBuffer if init() fails.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]