projects
/
platform
/
core
/
system
/
deviced.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7006aa5
)
battery: Add check NULL derefernce
67/296767/2
author
Yunhee Seo
<yuni.seo@samsung.com>
Fri, 4 Aug 2023 04:39:33 +0000
(13:39 +0900)
committer
Yunhee Seo
<yuni.seo@samsung.com>
Tue, 8 Aug 2023 02:33:04 +0000
(11:33 +0900)
Fix static analysis NULL dereferce issue.
Change-Id: Ib33ce3df0eab04c62c9096d78e09ff2e093edd57
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
src/battery/battery-parser.c
patch
|
blob
|
history
diff --git
a/src/battery/battery-parser.c
b/src/battery/battery-parser.c
index
91f8b50
..
e0370d5
100644
(file)
--- a/
src/battery/battery-parser.c
+++ b/
src/battery/battery-parser.c
@@
-97,6
+97,9
@@
static int parse_event_action(const struct parse_result *result, void *data)
info->event_handlers = realloc(info->event_handlers,
sizeof(struct battery_config_charger_event_handler*) * (info->event_handler_number + 1));
+ if (!info->event_handlers)
+ return 0;
+
info->event_handlers[info->event_handler_number++] = handler;
return 0;