summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-11-01 20:35:48 (EST)
committer graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-11-01 20:35:48 (EST)
commit03f8e73500e85ec1e8920d7c6ccc2a0a1ce4b830 (patch)
treeda3cc92a8c76fce3f88df110caa2d4eed7745f5c
parent9acb83792a99c08fc9e1fa37f9b064b4721f5693 (diff)
Free memory used when parsing a control file.
git-svn-id: http://opkg.googlecode.com/svn/trunk@234 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
-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;
}