Skip to content

helloworld.c memory leak or not? #3

@GoogleCodeExporter

Description

@GoogleCodeExporter
The comments inside helloworld.c shows there is an obviously memory leak.

/*
 * Allocates a new interpreter, and pushes a value into the global table.
 *
 * Returns a pointer to the iterator. Since no deallocation function has
 * been implemented, this will obviously leak memory.
 */

however, I'm  not sure on this, since the allocator used below can free memory 
blocks. Would you please clarify on this? 

static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {
  (void)ud;
  (void)osize;
  if (nsize == 0) {
    free(ptr);
    return NULL;
  }
  else
    return realloc(ptr, nsize);
}

Original issue reported on code.google.com by xu4wang@gmail.com on 18 Aug 2012 at 2:45

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions