add check after malloc allocation
This commit is contained in:
parent
0b23191a56
commit
afcdfae3a0
31
backport-Add-check-after-malloc-allocation.patch
Normal file
31
backport-Add-check-after-malloc-allocation.patch
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
From 466bd9dd8b8836af34f29976a5b0b83950bbe8ed Mon Sep 17 00:00:00 2001
|
||||||
|
From: Li kunyu <kunyu@nfschina.com>
|
||||||
|
Date: Mon, 19 Dec 2022 15:20:42 +0800
|
||||||
|
Subject: [PATCH] example_plugin: Add check after malloc allocation
|
||||||
|
|
||||||
|
Reference:https://github.com/rpm-software-management/libdnf/commit/466bd9dd8b8836af34f29976a5b0b83950bbe8ed
|
||||||
|
Conflict:NA
|
||||||
|
|
||||||
|
---
|
||||||
|
plugins/example_plugin.c | 8 +++++---
|
||||||
|
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/plugins/example_plugin.c b/plugins/example_plugin.c
|
||||||
|
index 3f1b119f31..a12439bffd 100644
|
||||||
|
--- a/plugins/example_plugin.c
|
||||||
|
+++ b/plugins/example_plugin.c
|
||||||
|
@@ -78,9 +78,11 @@ PluginHandle * pluginInitHandle(int version, PluginMode mode, DnfPluginInitData
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
handle = malloc(sizeof(*handle));
|
||||||
|
- handle->mode = mode;
|
||||||
|
- handle->context = pluginGetContext(initData);
|
||||||
|
- handle->outStream = outStream;
|
||||||
|
+ if (handle) {
|
||||||
|
+ handle->mode = mode;
|
||||||
|
+ handle->context = pluginGetContext(initData);
|
||||||
|
+ handle->outStream = outStream;
|
||||||
|
+ }
|
||||||
|
} while (0);
|
||||||
|
|
||||||
|
fprintf(outStream, "%s: %s: exit =========================\n", info.name, __func__);
|
||||||
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
Name: libdnf
|
Name: libdnf
|
||||||
Version: 0.69.0
|
Version: 0.69.0
|
||||||
Release: 3
|
Release: 4
|
||||||
Summary: Library providing simplified C and Python API to libsolv
|
Summary: Library providing simplified C and Python API to libsolv
|
||||||
License: LGPLv2+
|
License: LGPLv2+
|
||||||
URL: https://github.com/rpm-software-management/libdnf
|
URL: https://github.com/rpm-software-management/libdnf
|
||||||
@ -44,6 +44,7 @@ Patch6000: backport-query-py-ensure-reldep-is-from-the-same-sack
|
|||||||
%ifarch loongarch64
|
%ifarch loongarch64
|
||||||
Patch6001: 0001-libdnf-0.65.0-add-loongarch-support.patch
|
Patch6001: 0001-libdnf-0.65.0-add-loongarch-support.patch
|
||||||
%endif
|
%endif
|
||||||
|
Patch6002: backport-Add-check-after-malloc-allocation.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
A Library providing simplified C and Python API to libsolv.
|
A Library providing simplified C and Python API to libsolv.
|
||||||
@ -123,6 +124,9 @@ popd
|
|||||||
%{python3_sitearch}/hawkey/
|
%{python3_sitearch}/hawkey/
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Apr 21 2023 zhangrui <zhangrui182@huawei.com> - 0.69.0-4
|
||||||
|
- DESC:add check after malloc allocation
|
||||||
|
|
||||||
* Thu Jan 5 2023 zhangrui <zhangrui182@huawei.com> - 0.69.0-3
|
* Thu Jan 5 2023 zhangrui <zhangrui182@huawei.com> - 0.69.0-3
|
||||||
- DESC:add loongarch
|
- DESC:add loongarch
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user