From 03f8e73500e85ec1e8920d7c6ccc2a0a1ce4b830 Mon Sep 17 00:00:00 2001 From: graham.gower Date: Sun, 01 Nov 2009 20:35:48 -0500 Subject: Free memory used when parsing a control file. git-svn-id: http://opkg.googlecode.com/svn/trunk@234 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358 --- 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; } -- cgit v0.9.1