You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dcmtk/SOURCES/0022-CVE-2022-43272-Fixed-m...

54 lines
1.9 KiB

From 17ae64c748e821c5aa0cf62689ce77afa741e721 Mon Sep 17 00:00:00 2001
From: Marco Eichelberg <dicom@offis.de>
Date: Thu, 9 Jun 2022 10:03:38 +0200
Subject: [PATCH 22/22] [CVE-2022-43272] Fixed memory leak in single process
mode.
Fixed a memory leak in dcmqrscp's single process mode.
Thanks to <songxiangpu@mail.sdu.edu.cn> for the bug report and test data.
(cherry picked from commit c34f4e46e672ad21accf04da0dc085e43be6f5e1)
---
dcmqrdb/libsrc/dcmqrsrv.cc | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/dcmqrdb/libsrc/dcmqrsrv.cc b/dcmqrdb/libsrc/dcmqrsrv.cc
index 7f01409c5..1702fa460 100644
--- a/dcmqrdb/libsrc/dcmqrsrv.cc
+++ b/dcmqrdb/libsrc/dcmqrsrv.cc
@@ -1112,21 +1112,17 @@ OFCondition DcmQueryRetrieveSCP::waitForAssociation(T_ASC_Network * theNet)
#endif
}
- // cleanup code
+ // clean-up association
OFCondition oldcond = cond; /* store condition flag for later use */
- if (!options_.singleProcess_ && (cond != ASC_SHUTDOWNAPPLICATION))
+ cond = ASC_dropAssociation(assoc);
+ if (cond.bad())
{
- /* the child will handle the association, we can drop it */
- cond = ASC_dropAssociation(assoc);
- if (cond.bad())
- {
- DCMQRDB_ERROR("Cannot Drop Association: " << DimseCondition::dump(temp_str, cond));
- }
- cond = ASC_destroyAssociation(&assoc);
- if (cond.bad())
- {
- DCMQRDB_ERROR("Cannot Destroy Association: " << DimseCondition::dump(temp_str, cond));
- }
+ DCMQRDB_ERROR("Cannot Drop Association: " << DimseCondition::dump(temp_str, cond));
+ }
+ cond = ASC_destroyAssociation(&assoc);
+ if (cond.bad())
+ {
+ DCMQRDB_ERROR("Cannot Destroy Association: " << DimseCondition::dump(temp_str, cond));
}
if (oldcond == ASC_SHUTDOWNAPPLICATION) cond = oldcond; /* abort flag is reported to top-level wait loop */
--
2.39.2