1 Star 0 Fork 68

hexiaole1994/util-linux

forked from src-openEuler/util-linux 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-libfdisk-dereference-of-possibly-NULL-gcc-analyzer.patch 746 Bytes
一键复制 编辑 原始数据 按行查看 历史
shangyibin 提交于 2022-06-20 17:29 +08:00 . sync patches
From fb1689c1de5fdc945c599aa46b483fa5e1333935 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Wed, 18 Aug 2021 11:15:55 +0200
Subject: [PATCH] libfdisk: dereference of possibly-NULL [gcc-analyzer]
Signed-off-by: Karel Zak <kzak@redhat.com>
---
libfdisk/src/parttype.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libfdisk/src/parttype.c b/libfdisk/src/parttype.c
index 3a5db9c..271b671 100644
--- a/libfdisk/src/parttype.c
+++ b/libfdisk/src/parttype.c
@@ -26,6 +26,9 @@ struct fdisk_parttype *fdisk_new_parttype(void)
{
struct fdisk_parttype *t = calloc(1, sizeof(*t));
+ if (!t)
+ return NULL;
+
t->refcount = 1;
t->flags = FDISK_PARTTYPE_ALLOCATED;
DBG(PARTTYPE, ul_debugobj(t, "alloc"));
--
1.8.3.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hexiaole1994/util-linux.git
git@gitee.com:hexiaole1994/util-linux.git
hexiaole1994
util-linux
util-linux
master

搜索帮助