projects
/
platform
/
core
/
system
/
crash-worker.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6df407e
)
Handle memory allocation fail cases
60/307360/2
author
Sung-hun Kim
<sfoon.kim@samsung.com>
Thu, 7 Mar 2024 06:46:43 +0000
(15:46 +0900)
committer
Sung-hun Kim
<sfoon.kim@samsung.com>
Fri, 8 Mar 2024 02:05:57 +0000
(11:05 +0900)
This patch fixes a svace issue (wgid: 694845).
Change-Id: I27cb95a4327ac42dd8bff5f64e98ade2e91b2730
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
src/crash-json2info/crash-json2info.c
patch
|
blob
|
history
diff --git
a/src/crash-json2info/crash-json2info.c
b/src/crash-json2info/crash-json2info.c
index
083e37e
..
f864449
100644
(file)
--- a/
src/crash-json2info/crash-json2info.c
+++ b/
src/crash-json2info/crash-json2info.c
@@
-57,6
+57,11
@@
static json_object *parse_json(FILE *fp)
goto exit;
buff = malloc(size);
+ if (!buff) {
+ printf("Memory allocation failed for JSON buffer %m\n");
+ goto exit;
+ }
+
if (fread(buff, size, 1, fp) != 1) {
printf("Cannot read the file: %d\n", ferror(fp));
goto exit;