fix heap hint and type

pull/291/head
Jacob Barthelmeh 2020-10-16 10:57:27 -06:00
parent e693e159a0
commit 209d5f5c16
1 changed files with 3 additions and 3 deletions

View File

@ -9213,7 +9213,7 @@ int wolfSSH_CleanPath(WOLFSSH* ssh, char* in)
} }
sz = (long)WSTRLEN(in); sz = (long)WSTRLEN(in);
path = (char*)WMALLOC(sz+1, ssh->ctx->heap, DYNTYPE_TEMP); path = (char*)WMALLOC(sz+1, ssh->ctx->heap, DYNTYPE_PATH);
if (path == NULL) { if (path == NULL) {
return WS_MEMORY_E; return WS_MEMORY_E;
} }
@ -9352,13 +9352,13 @@ int wolfSSH_CleanPath(WOLFSSH* ssh, char* in)
/* copy result back to 'in' buffer */ /* copy result back to 'in' buffer */
if (WSTRLEN(in) < WSTRLEN(path)) { if (WSTRLEN(in) < WSTRLEN(path)) {
WLOG(WS_LOG_ERROR, "Fatal error cleaning path"); WLOG(WS_LOG_ERROR, "Fatal error cleaning path");
WFREE(path, ssh->heap, DYNTYPE_TMP); WFREE(path, ssh->ctx->heap, DYNTYPE_PATH);
return WS_BUFFER_E; return WS_BUFFER_E;
} }
sz = WSTRLEN(path); sz = WSTRLEN(path);
WMEMCPY(in, path, sz); WMEMCPY(in, path, sz);
in[sz] = '\0'; in[sz] = '\0';
WFREE(path, ssh->heap, DYNTYPE_TMP); WFREE(path, ssh->ctx->heap, DYNTYPE_PATH);
return (int)sz; return (int)sz;
} }
#endif /* WOLFSSH_SFTP || WOLFSSH_SCP */ #endif /* WOLFSSH_SFTP || WOLFSSH_SCP */