1 Star 0 Fork 10

syyhao/deltarpm

forked from src-openEuler/deltarpm 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0004-Return-error-rather-than-crashing-if-we-can-t-alloca.patch 1.06 KB
一键复制 编辑 原始数据 按行查看 历史
hexiaowen 提交于 2019-09-30 10:36 . Package init
From 1d0657b29ee72e842e0d1ada61ea0177b3159a8e Mon Sep 17 00:00:00 2001
From: Jonathan Dieter <jdieter@lesbg.com>
Date: Mon, 12 Jan 2015 13:47:51 +0200
Subject: [PATCH 4/4] Return error rather than crashing if we can't allocate
memory
Signed-off-by: Jonathan Dieter <jdieter@lesbg.com>
---
deltarpmmodule.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/deltarpmmodule.c b/deltarpmmodule.c
index cf333b6..40ea60f 100644
--- a/deltarpmmodule.c
+++ b/deltarpmmodule.c
@@ -46,6 +46,11 @@ PyObject *createDict(struct deltarpm d)
if (d.seq) {
char *tmp = calloc(d.seql * 2 + 1, sizeof(char));
int i;
+
+ if(tmp == NULL) {
+ PyErr_SetFromErrno(PyExc_SystemError);
+ return NULL;
+ }
for (i = 0; i < d.seql; i++) {
char buf[3];
@@ -54,6 +59,10 @@ PyObject *createDict(struct deltarpm d)
}
o = PyString_FromString(tmp);
free(tmp);
+ if(o == NULL) {
+ PyErr_SetFromErrno(PyExc_SystemError);
+ return NULL;
+ }
PyDict_SetItemString(dict, "seq", o);
Py_DECREF(o);
} else {
--
2.1.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/shenyangyang01/deltarpm.git
git@gitee.com:shenyangyang01/deltarpm.git
shenyangyang01
deltarpm
deltarpm
master

搜索帮助