A free() for every malloc. #3

Merged
merged 1 commit into from May 16, 2012

2 participants

@splinterofchaos

A lot of code looked almost exactly the same:

char * s = malloc(snprintf(NULL, 0, "%s/%s", x, y) + 1);
snprintf(s, "%s/%s", x, y);

Now, one call to allocFilename("%s/%s",x,y) does the trick. Also added a
freeFilename for each alloc instance to avoid a memory leak.

@splinterofchaos splinterofchaos A free for each malloc.
A lot of code looked almost exactly the same:
    char * s = malloc(snprintf(NULL, 0, "%s/%s", x, y) + 1);
    snprintf(s, "%s/%s", x, y);
Now, one call to allocFilename("%s/%s",x,y) does the trick. Also added a
freeFilename for each alloc instance.
43ff217
@Jonovono Jonovono merged commit 8aa7e9d into Jonovono:master May 16, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment