Explorar el Código

update:luat_crypto_cipher_xxx 释放添加防护 https://gitee.com/openLuat/LuatOS/issues/IABMR0?from=project-issue

Dozingfiretruck hace 1 año
padre
commit
4fecee50f8
Se han modificado 1 ficheros con 6 adiciones y 2 borrados
  1. 6 2
      components/crypto/luat_crypto_mbedtls.c

+ 6 - 2
components/crypto/luat_crypto_mbedtls.c

@@ -183,11 +183,15 @@ int luat_crypto_cipher_xxx(luat_crypto_cipher_ctx_t* cctx) {
     }
 
 _exit:
-	luat_heap_free(temp);
+    if (temp){
+        luat_heap_free(temp);
+    }
     mbedtls_cipher_free(&ctx);
     return 0;
 _error_exit:
-	luat_heap_free(temp);
+    if (temp){
+        luat_heap_free(temp);
+    }
 	mbedtls_cipher_free(&ctx);
 	return -1;
 }