aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Woodward2009-08-11 20:22:53 -0400
committerJason Woodward2009-08-11 20:22:53 -0400
commit4cf44bb68c4a3c6320f7e7b25a1ced919b49c16e (patch)
treec371f5fbccad4961852395dfa1ddae80274662f8
parent68f3b48a0c5f7a399b1a25eff4cd4a410de96a8d (diff)
downloadslapt-get-4cf44bb68c4a3c6320f7e7b25a1ced919b49c16e.tar.gz
free priority string and priority regex after parsing.
-rw-r--r--src/package.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/package.c b/src/package.c
index 9b7a8dd..6f099cf 100644
--- a/src/package.c
+++ b/src/package.c
@@ -154,7 +154,11 @@ struct slapt_pkg_list *slapt_parse_packages_txt(FILE *pkg_list_fh)
slapt_execute_regex(priority_regex, getline_buffer);
if (priority_regex->reg_return == 0) {
- tmp_pkg->priority = atoi(slapt_regex_extract_match(priority_regex, getline_buffer, 1));
+ char *priority_string = slapt_regex_extract_match(priority_regex, getline_buffer, 1);
+ if (priority_string != NULL) {
+ tmp_pkg->priority = atoi(priority_string);
+ free(priority_string);
+ }
} else {
/* priority isn't provided... rewind one line */
fseek(pkg_list_fh, (ftell(pkg_list_fh) - f_pos) * -1, SEEK_CUR);
@@ -431,8 +435,10 @@ struct slapt_pkg_list *slapt_parse_packages_txt(FILE *pkg_list_fh)
if (getline_buffer)
free(getline_buffer);
+
slapt_free_regex(name_regex);
slapt_free_regex(mirror_regex);
+ slapt_free_regex(priority_regex);
slapt_free_regex(location_regex);
slapt_free_regex(size_c_regex);
slapt_free_regex(size_u_regex);