public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "wenyi,xie" <xiewenyi2@huawei.com>
To: <devel@edk2.groups.io>
Cc: <songdongkuang@huawei.com>, <xiewenyi2@huawei.com>,
	Bob Feng <bob.c.feng@intel.com>,
	Liming Gao <gaoliming@byosoft.com.cn>,
	Yuwei Chen <yuwei.chen@intel.com>
Subject: [PATCH EDK2 v1 1/1] BaseTools/VfrCompile: add NULL point check
Date: Fri, 13 Nov 2020 11:30:30 +0800	[thread overview]
Message-ID: <1605238230-35859-2-git-send-email-xiewenyi2@huawei.com> (raw)
In-Reply-To: <1605238230-35859-1-git-send-email-xiewenyi2@huawei.com>

add NULL point check after allocating.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
---
 BaseTools/Source/C/VfrCompile/Pccts/antlr/main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/main.c b/BaseTools/Source/C/VfrCompile/Pccts/antlr/main.c
index 051ee4ec5d28..122878fc49e9 100644
--- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/main.c
+++ b/BaseTools/Source/C/VfrCompile/Pccts/antlr/main.c
@@ -1704,6 +1704,7 @@ char *s;
 	require(ua!=NULL, "cannot allocate UserAction");
 
 	ua->action = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char));
+    require(ua->action!=NULL, "cannot allocate action");
 	strcpy(ua->action, s);
 	return ua;
 }
@@ -1742,6 +1743,7 @@ int altnum;
 	char *p;
 	sprintf(buf, "_blk%d_alt%d", blockid, altnum);
 	p = (char *)malloc(strlen(buf)+1);
+    require(p!=NULL, "cannot allocate buf");
 	strcpy(p, buf);
 	return p;
 }
-- 
2.20.1.windows.1


  reply	other threads:[~2020-11-13  3:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-13  3:30 [PATCH EDK2 v1 0/1] BaseTools/VfrCompile: add NULL point check wenyi,xie
2020-11-13  3:30 ` wenyi,xie [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-11-13  9:45 wenyi,xie
2020-11-13  9:45 ` [PATCH EDK2 v1 1/1] " wenyi,xie

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-list 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=1605238230-35859-2-git-send-email-xiewenyi2@huawei.com \
    --to=devel@edk2.groups.io \
    /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