Skip to content

Commit 9cac434

Browse files
Move the out buffer allocation
1 parent e8f54ae commit 9cac434

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/wolfsftp.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2172,17 +2172,17 @@ int wolfSSH_SFTP_RecvOpen(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
21722172
}
21732173
#endif
21742174

2175-
if (ret == WS_SUCCESS) {
2176-
/* create packet */
2177-
out = (byte*)WMALLOC(outSz, ssh->ctx->heap, DYNTYPE_BUFFER);
2178-
if (out == NULL) {
2175+
/* create packet */
2176+
out = (byte*)WMALLOC(outSz, ssh->ctx->heap, DYNTYPE_BUFFER);
2177+
if (out == NULL) {
2178+
if (ret == WS_SUCCESS) {
21792179
#ifdef MICROCHIP_MPLAB_HARMONY
21802180
WFCLOSE(ssh->fs, &fd);
21812181
#else
21822182
WCLOSE(ssh->fs, fd);
21832183
#endif
2184-
return WS_MEMORY_E;
21852184
}
2185+
return WS_MEMORY_E;
21862186
}
21872187
if (ret == WS_SUCCESS) {
21882188
if (SFTP_CreatePacket(ssh, WOLFSSH_FTP_HANDLE, out, outSz,

0 commit comments

Comments
 (0)