Skip to content

Commit 6408bc1

Browse files
committed
Fix: Clean up in update_scap_affected_products, fix CLI option
The update_scap_affected_products function now frees the buffer of CVE ids used in its SQL and the CVEs iterator. Also, the affected_products_query_size is now set correctly.
1 parent a85a51b commit 6408bc1

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/manage_sql_secinfo.c

+8-7
Original file line numberDiff line numberDiff line change
@@ -4088,14 +4088,14 @@ update_scap_affected_products ()
40884088
{
40894089
iterator_t cves_iter;
40904090
GString *cve_ids_buffer;
4091-
g_info ("Updating affected products");
4091+
int count = 0;
40924092

4093-
init_iterator(&cves_iter,
4094-
"SELECT DISTINCT cve_id FROM scap2.cpe_match_nodes");
4093+
g_info ("Updating affected products");
40954094

4096-
int count = 0;
4095+
init_iterator (&cves_iter,
4096+
"SELECT DISTINCT cve_id FROM scap2.cpe_match_nodes");
40974097

4098-
cve_ids_buffer = g_string_new("");
4098+
cve_ids_buffer = g_string_new ("");
40994099
while (next (&cves_iter))
41004100
{
41014101
resource_t cve_id;
@@ -4112,13 +4112,14 @@ update_scap_affected_products ()
41124112
g_debug ("%s: Products of %d CVEs processed", __func__, count);
41134113
}
41144114
}
4115+
cleanup_iterator (&cves_iter);
41154116

41164117
if (cve_ids_buffer->len)
41174118
{
41184119
exec_affected_products_sql (cve_ids_buffer->str);
4119-
g_string_truncate (cve_ids_buffer, 0);
41204120
g_debug ("%s: Products of %d CVEs processed", __func__, count);
41214121
}
4122+
g_free (cve_ids_buffer);
41224123

41234124
}
41244125

@@ -5842,7 +5843,7 @@ set_affected_products_query_size (int new_size)
58425843
if (new_size <= 0)
58435844
affected_products_query_size = AFFECTED_PRODUCTS_QUERY_SIZE_DEFAULT;
58445845
else
5845-
secinfo_commit_size = new_size;
5846+
affected_products_query_size = new_size;
58465847
}
58475848

58485849
/**

0 commit comments

Comments
 (0)