Linux Media Controller development
 help / color / mirror / Atom feed
* [PATCH v4l-utils] Add missing allocation failure check
@ 2026-07-17 16:54 Sai Vishnu M
  2026-09-09 14:31 ` Hans Verkuil
  0 siblings, 1 reply; 2+ messages in thread
From: Sai Vishnu M @ 2026-07-17 16:54 UTC (permalink / raw)
  To: linux-media; +Cc: Sai Vishnu M

Signed-off-by: Sai Vishnu <saivishnu725@gmail.com>
---
 utils/common/keymap.c | 11 ++++++++++-
 1 file change
 d, 10 insertions(+), 1 deletion(-)

diff --git a/utils/common/keymap.c b/utils/common/keymap.c
index 21c1c0b5..b881187a 100644
--- a/utils/common/keymap.c
+++ b/utils/common/keymap.c
@@ -124,7 +124,11 @@ static error_t parse_plain_keymap(char *fname, struct keymap **keymap, bool verb
 							struct keymap *k;
 
 							k = calloc(1, sizeof(*k));
-							k->protocol = strdup(p);
+                            if (!k) {
+								perror("parse_keymap");
+								return ENOMEM;
+							}
+                            k->protocol = strdup(p);
 							k->next = map->next;
 							map->next = k;
 						}
@@ -399,6 +403,11 @@ static error_t parse_toml_protocol(const char *fname, struct toml_table_t *proot
 			struct protocol_param *param;
 
 			param = malloc(sizeof(*param));
+			if (!param) {
+				perror("parse_toml_protocol");
+				free_keymap(map);
+				return ENOMEM;
+			}
 			param->name = strdup(key);
 			param->value = value;
 			param->next = map->param;
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-09 14:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-17 16:54 [PATCH v4l-utils] Add missing allocation failure check Sai Vishnu M
2026-09-09 14:31 ` Hans Verkuil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox