Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8e419c00 authored by Piotr Jastrzebski's avatar Piotr Jastrzebski Committed by Android Git Automerger
Browse files

am af83392e: am 8750fa76: Merge "Make a copy of a prefix param in StartIteration"

* commit 'af83392e':
  Make a copy of a prefix param in StartIteration
parents 6a993053 af83392e
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -899,10 +899,12 @@ int32_t StartIteration(ZipArchiveHandle handle, void** cookie_ptr, const char* p

  IterationHandle* cookie = (IterationHandle*) malloc(sizeof(IterationHandle));
  cookie->position = 0;
  cookie->prefix = prefix;
  cookie->archive = archive;
  if (prefix != NULL) {
    cookie->prefix = strdup(prefix);
    cookie->prefix_len = strlen(prefix);
  } else {
    cookie->prefix = NULL;
  }

  *cookie_ptr = cookie ;
@@ -911,6 +913,10 @@ int32_t StartIteration(ZipArchiveHandle handle, void** cookie_ptr, const char* p

void EndIteration(void* cookie) {
  if (cookie != NULL) {
    IterationHandle* handle = reinterpret_cast<IterationHandle*>(cookie);
    if (handle->prefix != NULL) {
      free(const_cast<char*>(handle->prefix));
    }
    free(cookie);
  }
}