From: Sai Vishnu M <saivishnu725@gmail.com>
To: linux-media@vger.kernel.org
Cc: Sai Vishnu M <saivishnu725@gmail.com>
Subject: [PATCH v4l-utils] Add missing allocation failure check
Date: Fri, 17 Jul 2026 22:24:45 +0530 [thread overview]
Message-ID: <20260717165445.46734-1-saivishnu725@gmail.com> (raw)
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
reply other threads:[~2026-07-17 16:55 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260717165445.46734-1-saivishnu725@gmail.com \
--to=saivishnu725@gmail.com \
--cc=linux-media@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox