Просмотр исходного кода

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

Dozingfiretruck 1 год назад
Родитель
Сommit
4fecee50f8
1 измененных файлов с 6 добавлено и 2 удалено
  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;
 }