Netfs: Fix memory error
In Reader::Read(), memory is allocated to '*buffer' at line 40, but freed with 'buffer' at line 45. Pointed by Clang Static Analyzer. Change-Id: I18e49791da639a6bc2041e944a39ceb73a2e5055 Reviewed-on: https://review.haiku-os.org/c/haiku/+/1931 Reviewed-by: Axel Dörfler <[email protected]>
This commit is contained in:
committed by
Axel Dörfler
parent
715a29f47d
commit
61b433252a
@@ -42,7 +42,7 @@ Reader::Read(int32 size, void** buffer, bool* mustFree)
|
|||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
status_t error = Read(*buffer, size);
|
status_t error = Read(*buffer, size);
|
||||||
if (error != B_OK) {
|
if (error != B_OK) {
|
||||||
free(buffer);
|
free(*buffer);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
return error;
|
return error;
|
||||||
|
|||||||
Reference in New Issue
Block a user