lkml.org 
[lkml]   [2022]   [Oct]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] unicode: mkutf8data: Add malloc allocation check
Date
If malloc allocation fails, NULL is returned.

Signed-off-by: Li kunyu <kunyu@nfschina.com>
---
fs/unicode/mkutf8data.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/fs/unicode/mkutf8data.c b/fs/unicode/mkutf8data.c
index e06404a6b106..a929ddf1438c 100644
--- a/fs/unicode/mkutf8data.c
+++ b/fs/unicode/mkutf8data.c
@@ -495,6 +495,9 @@ static struct node *alloc_node(struct node *parent)
int bitnum;

node = malloc(sizeof(*node));
+ if (!node)
+ return NULL;
+
node->left = node->right = NULL;
node->parent = parent;
node->leftnode = NODE;
--
2.18.2
\
 
 \ /
  Last update: 2022-10-24 10:38    [W:0.040 / U:0.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site