Skip to content

Commit bc1ad77

Browse files
markjdbbapt
authored andcommitted
pkg-query: Fix memory leaks
Reported by leaksanitizer.
1 parent aa43be2 commit bc1ad77

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/query.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,8 @@ print_query(struct pkg *pkg, char *qstr, char multiline)
413413
format_str(pkg, output, qstr, str);
414414
printf("%s\n", output->buf);
415415
}
416+
free(slit);
417+
free(sl);
416418
break;
417419
case 'G':
418420
pkg_get(pkg, PKG_ATTR_GROUPS, &sl);
@@ -421,6 +423,8 @@ print_query(struct pkg *pkg, char *qstr, char multiline)
421423
format_str(pkg, output, qstr, str);
422424
printf("%s\n", output->buf);
423425
}
426+
free(slit);
427+
free(sl);
424428
break;
425429
case 'B':
426430
pkg_get(pkg, PKG_ATTR_SHLIBS_REQUIRED, &sl);
@@ -429,6 +433,8 @@ print_query(struct pkg *pkg, char *qstr, char multiline)
429433
format_str(pkg, output, qstr, str);
430434
printf("%s\n", output->buf);
431435
}
436+
free(slit);
437+
free(sl);
432438
break;
433439
case 'b':
434440
pkg_get(pkg, PKG_ATTR_SHLIBS_PROVIDED, &sl);
@@ -437,6 +443,8 @@ print_query(struct pkg *pkg, char *qstr, char multiline)
437443
format_str(pkg, output, qstr, str);
438444
printf("%s\n", output->buf);
439445
}
446+
free(slit);
447+
free(sl);
440448
break;
441449
case 'A':
442450
pkg_get(pkg, PKG_ATTR_ANNOTATIONS, &kl);

0 commit comments

Comments
 (0)