- const char *name = "rpm_Name";
- char tmpdir_name[strlen (g->tmpdir) + strlen (name) + 2];
- snprintf (tmpdir_name, sizeof tmpdir_name, "%s/%s",
- g->tmpdir, name);
-
- if (guestfs___download_to_tmp (g, "/var/lib/rpm/Name", name,
- MAX_PKG_DB_SIZE) == -1)
- return NULL;
-
- const char *pkgs = "rpm_Packages";
- char tmpdir_pkgs[strlen (g->tmpdir) + strlen (pkgs) + 2];
- snprintf (tmpdir_pkgs, sizeof tmpdir_pkgs, "%s/%s",
- g->tmpdir, pkgs);
-
- if (guestfs___download_to_tmp (g, "/var/lib/rpm/Packages", pkgs,
- MAX_PKG_DB_SIZE) == -1)
- return NULL;
-
- /* Allocate interim structure to store names and links. */
- struct rpm_names_list list;
- list.names = NULL;
- list.len = 0;
+ char *Name = NULL, *Packages = NULL;
+ struct rpm_names_list list = { .names = NULL, .len = 0 };
+ struct guestfs_application_list *apps = NULL;
+
+ Name = guestfs___download_to_tmp (g, fs,
+ "/var/lib/rpm/Name", "rpm_Name",
+ MAX_PKG_DB_SIZE);
+ if (Name == NULL)
+ goto error;
+
+ Packages = guestfs___download_to_tmp (g, fs,
+ "/var/lib/rpm/Packages", "rpm_Packages",
+ MAX_PKG_DB_SIZE);
+ if (Packages == NULL)
+ goto error;