Blob Blame History Raw
From 8615575144e6fd3d708a30983ed2415db479ef4c Mon Sep 17 00:00:00 2001
From: Jaroslav Rohel <jrohel@redhat.com>
Date: Thu, 8 Apr 2021 12:17:09 +0200
Subject: [PATCH] Fix: Memory leaks in SWIG generated code (for Python)

There were memory leaks in the `Chksum_from_bin`, `Chksum_add`,
`SolvFp_write` functions wrapper for Python.

The problem was in "freearg" typemap argument defined in "solv.i".
Therefore, the typemap was not applied.
---
 bindings/solv.i | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bindings/solv.i b/bindings/solv.i
index 1882b13..3bbeca0 100644
--- a/bindings/solv.i
+++ b/bindings/solv.i
@@ -63,7 +63,7 @@ typedef struct {
   $2 = size;
 }
 
-%typemap(freearg,noblock=1,match="in") (const unsigned char *str, int len) {
+%typemap(freearg,noblock=1,match="in") (const unsigned char *str, size_t len) {
   if (alloc$argnum == SWIG_NEWOBJ) %delete_array(buf$argnum);
 }
 
--
libgit2 1.0.1