Blame SOURCES/net-snmp-5.8-rpm-memory-leak.patch

17a0ab
diff -urNp a/agent/mibgroup/host/data_access/swinst_rpm.c b/agent/mibgroup/host/data_access/swinst_rpm.c
17a0ab
--- a/agent/mibgroup/host/data_access/swinst_rpm.c	2020-06-10 14:32:43.330486233 +0200
17a0ab
+++ b/agent/mibgroup/host/data_access/swinst_rpm.c	2020-06-10 14:35:46.672298741 +0200
17a0ab
@@ -75,6 +75,9 @@ netsnmp_swinst_arch_init(void)
17a0ab
     snprintf( pkg_directory, SNMP_MAXPATH, "%s/Packages", dbpath );
17a0ab
     SNMP_FREE(rpmdbpath);
17a0ab
     dbpath = NULL;
17a0ab
+#ifdef HAVE_RPMGETPATH
17a0ab
+    rpmFreeRpmrc();
17a0ab
+#endif
17a0ab
     if (-1 == stat( pkg_directory, &stat_buf )) {
17a0ab
         snmp_log(LOG_ERR, "Can't find directory of RPM packages");
17a0ab
         pkg_directory[0] = '\0';
17a0ab
diff -urNp a/agent/mibgroup/host/hr_swinst.c b/agent/mibgroup/host/hr_swinst.c
17a0ab
--- a/agent/mibgroup/host/hr_swinst.c	2020-06-10 14:32:43.325486184 +0200
17a0ab
+++ b/agent/mibgroup/host/hr_swinst.c	2020-06-10 14:36:44.423872418 +0200
17a0ab
@@ -231,6 +231,9 @@ init_hr_swinst(void)
17a0ab
             snprintf(path, sizeof(path), "%s/packages.rpm", swi->swi_dbpath);
17a0ab
         path[ sizeof(path)-1 ] = 0;
17a0ab
         swi->swi_directory = strdup(path);
17a0ab
+#ifdef HAVE_RPMGETPATH
17a0ab
+        rpmFreeRpmrc();
17a0ab
+#endif
17a0ab
     }
17a0ab
 #else
17a0ab
 #  ifdef _PATH_HRSW_directory