Skip to content

Commit

Permalink
Two memory leaks from calls for printf arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
cgull authored and bapt committed Jun 14, 2022
1 parent 79d1914 commit f7a9b6a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 6 additions & 2 deletions libpkg/pkg_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,7 @@ walk_repo_obj(const ucl_object_t *obj, const char *file, pkg_init_flags flags)
ucl_object_iter_t it = NULL;
struct pkg_repo *r;
const char *key;
const char *yaml;

while ((cur = ucl_iterate_object(obj, &it, true))) {
key = ucl_object_key(cur);
Expand All @@ -799,9 +800,12 @@ walk_repo_obj(const ucl_object_t *obj, const char *file, pkg_init_flags flags)
pkg_debug(1, "PkgConfig: overwriting repository %s", key);
if (cur->type == UCL_OBJECT)
add_repo(cur, r, key, flags);
else
else {
yaml = ucl_object_emit(cur, UCL_EMIT_YAML);
pkg_emit_error("Ignoring bad configuration entry in %s: %s",
file, ucl_object_emit(cur, UCL_EMIT_YAML));
file, yaml);
free(yaml);
}
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,13 +294,15 @@ show_plugin_info(void)
{
const pkg_object *conf;
struct pkg_plugin *p = NULL;
const char *dump;

while (pkg_plugins(&p) == EPKG_OK) {
conf = pkg_plugin_conf(p);
printf("Configuration for plugin: %s\n",
pkg_plugin_get(p, PKG_PLUGIN_NAME));

printf("%s\n", pkg_object_dump(conf));
dump = pkg_object_dump(conf);
printf("%s\n", dump);
free(dump);
}
}

Expand Down

0 comments on commit f7a9b6a

Please sign in to comment.