fix potential deref of a null pointer

This commit is contained in:
0tkl
2023-08-02 14:12:03 +08:00
parent 4ca66cc7fe
commit 434cd68a23
4 changed files with 10 additions and 8 deletions

View File

@@ -7,7 +7,7 @@
Authors: see AUTHORS
Copyright: see AUTHORS
License: see LICENSE
Last Updated: 04/02/2019
Last Updated: 08/02/2023
******************************************************************************
*/
@@ -36,6 +36,7 @@ error_handle_t *create_error_manager(void (*p_error_message)(int, char*, int))
{
error_handle_t *error_handle;
error_handle = (error_handle_t*)calloc(1, sizeof(error_handle_t));
if (error_handle == NULL) return NULL;
error_handle->p_msg_lookup = p_error_message;

View File

@@ -7,7 +7,7 @@
Authors: see AUTHORS
Copyright: see AUTHORS
License: see LICENSE
Last Updated: 04/01/2019
Last Updated: 08/02/2023
******************************************************************************
*/
@@ -41,6 +41,7 @@ file_handle_t *create_file_manager() {
file_handle_t *file_handle;
file_handle = (file_handle_t *)calloc(1, sizeof(file_handle_t));
if (file_handle == NULL) return NULL;
file_handle->filename = NULL;
file_handle->file = NULL;