... of course the debdiff attachment here -.-
diff -Nru libuio-0.3.0/debian/changelog libuio-0.3.0/debian/changelog
--- libuio-0.3.0/debian/changelog       2024-03-15 14:25:17.000000000 +0100
+++ libuio-0.3.0/debian/changelog       2026-11-16 21:31:00.000000000 +0100
@@ -1,3 +1,9 @@
+libuio (0.3.0-1+deb13u1) trixie; urgency=medium
+
+  * Backport memory leak fixes from upstream 0.4.1. (Closes: #1153813)
+
+ -- Burak Gerz <[email protected]>  Mon, 16 Nov 2026 21:31:00 +0100
+
 libuio (0.3.0-1) unstable; urgency=medium
 
   * Initial release. (Closes: #1063380)
diff -Nru 
libuio-0.3.0/debian/patches/0002-fix-memory-leak-in-uio_free_info.patch 
libuio-0.3.0/debian/patches/0002-fix-memory-leak-in-uio_free_info.patch
--- libuio-0.3.0/debian/patches/0002-fix-memory-leak-in-uio_free_info.patch     
1970-01-01 01:00:00.000000000 +0100
+++ libuio-0.3.0/debian/patches/0002-fix-memory-leak-in-uio_free_info.patch     
2026-11-16 21:31:00.000000000 +0100
@@ -0,0 +1,44 @@
+From 35405914d993537593a476f5989d8dee976ffc60 Mon Sep 17 00:00:00 2001
+From: Burak Gerz <[email protected]>
+Date: Mon, 16 Nov 2026 20:56:45 +0100
+Subject: [PATCH 1/5] fix: memory leak in uio_free_info
+
+introduce a wrapper for uio_free_info() to free memory from info
+structs not returned to the caller. we do not want to break beahviour
+like upstream does.
+
+upstream commit:
+https://github.com/missinglinkelectronics/libuio/commit/5d13ce1ec12c703bec8c8d06beb6918a6cdf4815
+---
+ base.c | 20 ++++++++++++++++++++
+ 1 file changed, 20 insertions(+)
+
+--- a/base.c
++++ b/base.c
+@@ -195,6 +195,26 @@
+ }
+ 
+ /**
++ * free UIO device information struct including the map names
++ * @param info UIO device info struct
++ */
++static void uio_free_info_internal (struct uio_info_t* info)
++{
++       int i;
++
++       if (info && info->maps)
++       {
++               for (i = 0; i < info->maxmap; i++)
++               {
++                       if (info->maps[i].name)
++                               free(info->maps[i].name);
++               }
++       }
++
++       uio_free_info (info);
++}
++
++/**
+  * find UIO devices
+  * @returns device list or NULL on failure
+  */
diff -Nru libuio-0.3.0/debian/patches/0003-fix-free-memory-correctly.patch 
libuio-0.3.0/debian/patches/0003-fix-free-memory-correctly.patch
--- libuio-0.3.0/debian/patches/0003-fix-free-memory-correctly.patch    
1970-01-01 01:00:00.000000000 +0100
+++ libuio-0.3.0/debian/patches/0003-fix-free-memory-correctly.patch    
2026-11-16 21:31:00.000000000 +0100
@@ -0,0 +1,21 @@
+From 7c43c918525f24a46270bf8f84f90ca7ad0886f0 Mon Sep 17 00:00:00 2001
+From: Burak Gerz <[email protected]>
+Date: Mon, 16 Nov 2026 21:08:31 +0100
+Subject: [PATCH 2/5] fix: free memory correctly
+
+use the uio_free_info_internal() func to free all memory in error case
+---
+ base.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/base.c
++++ b/base.c
+@@ -308,7 +308,7 @@
+       info = create_uio_info (sysfsname, name);
+       if (errno)
+       {
+-              uio_free_info (info);
++              uio_free_info_internal (info);
+               info = NULL;
+       }
+ 
diff -Nru 
libuio-0.3.0/debian/patches/0004-fix-memory-leak-in-uio_find_by_uio_name.patch 
libuio-0.3.0/debian/patches/0004-fix-memory-leak-in-uio_find_by_uio_name.patch
--- 
libuio-0.3.0/debian/patches/0004-fix-memory-leak-in-uio_find_by_uio_name.patch  
    1970-01-01 01:00:00.000000000 +0100
+++ 
libuio-0.3.0/debian/patches/0004-fix-memory-leak-in-uio_find_by_uio_name.patch  
    2026-11-16 21:31:00.000000000 +0100
@@ -0,0 +1,32 @@
+From 7ff0ed9a665df2cf2b6a1da69972f1d8625543c8 Mon Sep 17 00:00:00 2001
+From: modbw <[email protected]>
+Date: Thu, 2 Sep 2021 10:09:26 +0200
+Subject: [PATCH 3/5] fix: memory leak in uio_find_by_uio_name
+
+when a uio_info_t doesnt match the searched name, then it will be freed
+
+upstream commit:
+https://github.com/missinglinkelectronics/libuio/commit/1499fe41f38b1ed7b4d2444abd14464ffdca4390
+---
+ base.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+--- a/base.c
++++ b/base.c
+@@ -281,11 +281,14 @@
+ 
+               name = uio_get_name (candidate);
+ 
+-              if (!strcmp (name, uio_name)) {
++              if ((!info) && (!strcmp (name, uio_name))) {
+                       info = candidate;
+-                      break;
+               }
++              else
++                      uio_free_info_internal(candidate);
++
+       }
++
+       free (uio_list);
+ 
+       return info;
diff -Nru libuio-0.3.0/debian/patches/0005-fix-free-on-invalid-pointer.patch 
libuio-0.3.0/debian/patches/0005-fix-free-on-invalid-pointer.patch
--- libuio-0.3.0/debian/patches/0005-fix-free-on-invalid-pointer.patch  
1970-01-01 01:00:00.000000000 +0100
+++ libuio-0.3.0/debian/patches/0005-fix-free-on-invalid-pointer.patch  
2026-11-16 21:31:00.000000000 +0100
@@ -0,0 +1,34 @@
+From fc63c8fa16ece111e461ad638b69d7cf9adec684 Mon Sep 17 00:00:00 2001
+From: David Epping <[email protected]>
+Date: Sat, 17 Oct 2026 21:40:02 +0200
+Subject: [PATCH 4/5] fix: free() on invalid pointer
+
+upstream commit:
+https://github.com/missinglinkelectronics/libuio/commit/535498a872fffae4becfb5fd3d71536cf2d027f7
+---
+ lsuio.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/lsuio.c
++++ b/lsuio.c
+@@ -76,7 +76,7 @@
+ 
+ int main (int argc, char **argv)
+ {
+-      struct uio_info_t **uio_list, *info;
++      struct uio_info_t **uio_list, **uio_list_iter, *info;
+       char **attr, **tmp;
+       int i;
+ 
+@@ -90,9 +90,9 @@
+               return 1;
+       }
+ 
+-      for (;*uio_list; uio_list++)
++      for (uio_list_iter = uio_list; *uio_list_iter; uio_list_iter++)
+       {
+-              info = *uio_list;
++              info = *uio_list_iter;
+               g_print (_("Name   : %s\n"), uio_get_name (info));
+               g_print (_("Version: %s\n"), uio_get_version (info));
+               g_print (_("DevId  : %d:%d\n"), uio_get_major (info),
diff -Nru 
libuio-0.3.0/debian/patches/0006-fix-memory-leak-in-uio_find_by_base_addr.patch 
libuio-0.3.0/debian/patches/0006-fix-memory-leak-in-uio_find_by_base_addr.patch
--- 
libuio-0.3.0/debian/patches/0006-fix-memory-leak-in-uio_find_by_base_addr.patch 
    1970-01-01 01:00:00.000000000 +0100
+++ 
libuio-0.3.0/debian/patches/0006-fix-memory-leak-in-uio_find_by_base_addr.patch 
    2026-11-16 21:31:00.000000000 +0100
@@ -0,0 +1,33 @@
+From 2ee0035e59aea950d7932971700c196ff2effd0f Mon Sep 17 00:00:00 2001
+From: Burak Gerz <[email protected]>
+Date: Sun, 15 Nov 2026 11:30:11 +0100
+Subject: [PATCH 5/5] fix: memory leak in uio_find_by_base_addr
+
+upstream commit:
+https://github.com/missinglinkelectronics/libuio/commit/8b6e89f85f498a892909dea92270b5dc30842630
+---
+ base.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/base.c
++++ b/base.c
+@@ -339,7 +339,7 @@
+               /* get number of maps and go through each checking the base 
address */
+               mapnum = uio_get_maxmap(candidate);
+ 
+-              for (mapc = 0; mapc < mapnum; mapc++)
++              for (mapc = 0; !found && mapc < mapnum; mapc++)
+               {
+                       if (base_addr == uio_get_mem_addr(candidate, mapc))
+                       {
+@@ -349,8 +349,8 @@
+                       }
+               }
+ 
+-              if (found)
+-                      break;
++              if (candidate != info)
++                      uio_free_info_internal(candidate);
+       }
+ 
+       free (uio_list);
diff -Nru libuio-0.3.0/debian/patches/series libuio-0.3.0/debian/patches/series
--- libuio-0.3.0/debian/patches/series  2024-03-15 14:25:17.000000000 +0100
+++ libuio-0.3.0/debian/patches/series  2026-11-16 21:31:00.000000000 +0100
@@ -1 +1,6 @@
 0001-irq-Make-enabling-disabling-endianess-safe.patch
+0002-fix-memory-leak-in-uio_free_info.patch
+0003-fix-free-memory-correctly.patch
+0004-fix-memory-leak-in-uio_find_by_uio_name.patch
+0005-fix-free-on-invalid-pointer.patch
+0006-fix-memory-leak-in-uio_find_by_base_addr.patch

Reply via email to