summaryrefslogtreecommitdiffstats
path: root/libopkg
diff options
context:
space:
mode:
Diffstat (limited to 'libopkg')
-rw-r--r--libopkg/pkg.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libopkg/pkg.c b/libopkg/pkg.c
index 0c7bb5a..4496bfd 100644
--- a/libopkg/pkg.c
+++ b/libopkg/pkg.c
@@ -284,7 +284,7 @@ void pkg_deinit(pkg_t *pkg)
int pkg_init_from_file(pkg_t *pkg, const char *filename)
{
int err;
- char **raw;
+ char **raw, **raw_start;
FILE *control_file;
err = pkg_init(pkg);
@@ -297,11 +297,17 @@ int pkg_init_from_file(pkg_t *pkg, const char *filename)
if (err) { return err; }
rewind(control_file);
- raw = read_raw_pkgs_from_stream(control_file);
+ raw = raw_start = read_raw_pkgs_from_stream(control_file);
pkg_parse_raw(pkg, &raw, NULL, NULL);
fclose(control_file);
+ raw = raw_start;
+ while (*raw) {
+ free(*raw++);
+ }
+ free(raw_start);
+
return 0;
}