From 5717ea86aa28e2e44593e19eb158af0406c5412c Mon Sep 17 00:00:00 2001 From: zls <1026904535@qq.com> Date: Sat, 4 Jan 2025 16:36:49 +0800 Subject: [PATCH] =?UTF-8?q?sane=E6=A1=86=E6=9E=B6=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zls <1026904535@qq.com> --- BUILD.gn | 5 ++++- install.py | 3 ++- patches/dll.c.patch | 17 +++++++++++++++++ patches/patches.json | 9 --------- 4 files changed, 23 insertions(+), 11 deletions(-) create mode 100644 patches/dll.c.patch delete mode 100644 patches/patches.json diff --git a/BUILD.gn b/BUILD.gn index 8e71ce574..4e2439318 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -27,7 +27,10 @@ target_dir = "${target_gen_dir}/sane" action("backends_action") { print("backends_action is exec") script = "//third_party/backends/install.py" - inputs = [ "${source_dir}/patches/modifying_driver_search_path.patch" ] + inputs = [ + "${source_dir}/patches/modifying_driver_search_path.patch", + "${source_dir}/patches/dll.c.patch" + ] outputs = [ "${target_dir}/include/config.h", "${target_dir}/src/dll.c", diff --git a/install.py b/install.py index 1e12b2a27..fcd1ea83e 100755 --- a/install.py +++ b/install.py @@ -23,7 +23,8 @@ import shutil def apply_patch(source_dir): patch_list = [ - 'modifying_driver_search_path.patch' + 'modifying_driver_search_path.patch', + 'dll.c.patch' ] for patch in patch_list: diff --git a/patches/dll.c.patch b/patches/dll.c.patch new file mode 100644 index 000000000..84b2ef77d --- /dev/null +++ b/patches/dll.c.patch @@ -0,0 +1,17 @@ +diff --git a/backend/dll.c b/backend/dll.c +index 7cb7fd508..69918099f 100644 +--- a/backend/dll.c ++++ b/backend/dll.c +@@ -1349,6 +1349,12 @@ sane_open (SANE_String_Const full_name, SANE_Handle * meta_handle) + } + free(be_name); + ++ if (!be) ++ { ++ DBG (3, "sane_open: be is nullptr\n"); ++ return SANE_STATUS_NO_MEM; ++ } ++ + if (!be->inited) + { + status = init (be); \ No newline at end of file diff --git a/patches/patches.json b/patches/patches.json deleted file mode 100644 index bb7e9f788..000000000 --- a/patches/patches.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "patches": [ - { - "project": "print_print_fwk", - "path": "base/print/print_fwk", - "pr_url": "https://gitee.com/openharmony/print_print_fwk/pulls/288" - } - ] -} \ No newline at end of file -- Gitee