Skip to content

Commit 8ded458

Browse files
committed
Plug a memory leak in CVRF
If there is 0 iterations of the outer while loop, the 'filtered_ids' variable isn't freed. Fortunately, we can allocate it inside the while loop. If it's not free'd in this function, it is free'd in cvrf_product_status_free.
1 parent b135e91 commit 8ded458

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/CVRF/cvrf_priv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,14 +512,14 @@ struct cvrf_vulnerability *cvrf_vulnerability_clone(const struct cvrf_vulnerabil
512512
}
513513

514514
int cvrf_vulnerability_filter_by_product(struct cvrf_vulnerability *vuln, const char *prod) {
515-
struct oscap_stringlist *filtered_ids = oscap_stringlist_new();
516515
int ret = 0;
517516

518517
struct cvrf_product_status_iterator *statuses = cvrf_vulnerability_get_product_statuses(vuln);
519518
while (cvrf_product_status_iterator_has_more(statuses)) {
520519
struct cvrf_product_status *stat = cvrf_product_status_iterator_next(statuses);
521520

522521
struct oscap_string_iterator *products = cvrf_product_status_get_ids(stat);
522+
struct oscap_stringlist *filtered_ids = oscap_stringlist_new();
523523
while (oscap_string_iterator_has_more(products)) {
524524
const char *product_id = oscap_string_iterator_next(products);
525525
if (oscap_str_startswith(product_id, prod))

0 commit comments

Comments
 (0)