#include <ostree.h>
#include <stdlib.h>

extern "C" OstreeDeployment *ostree_sysroot_get_booted_deployment(OstreeSysroot *self) {
  (void)self;
  const char *hash = getenv("OSTREE_HASH");
  return ostree_deployment_new(0, "dummy-os", hash, 1, hash, 1);
}

extern "C" const char *ostree_deployment_get_csum(OstreeDeployment *self) {
  (void)self;
  return getenv("OSTREE_HASH");
}

#include <ostree.h>
#include <stdlib.h>

extern "C" OstreeDeployment *ostree_sysroot_get_booted_deployment(OstreeSysroot *self) {
  (void)self;
  static OstreeDeployment *deployment;

  if (deployment != nullptr) {
    return deployment;
  }

  const char *hash = getenv("OSTREE_HASH");
  deployment = ostree_deployment_new(0, "dummy-os", hash, 1, hash, 1);
  return deployment;
}

extern "C" const char *ostree_deployment_get_csum(OstreeDeployment *self) {
  (void)self;
  return getenv("OSTREE_HASH");
}

Fix mem leak in test code
aktualizr-lite: Fix mem leak in test code

Pretty much the same idea as:

 https://github.com/advancedtelematic/aktualizr/pull/1398

Signed-off-by: Andy Doan <e3579b1e47f273529f0f929453e939a68ede9fd1@foundries.io>
