diff options
author | Lars-Dominik Braun <PromyLOPh@lavabit.com> | 2009-05-10 11:52:38 +0200 |
---|---|---|
committer | Lars-Dominik Braun <PromyLOPh@lavabit.com> | 2009-05-10 11:52:38 +0200 |
commit | e5f9ebb8e767ba78800b203f14b2b3a2c9a22787 (patch) | |
tree | a8487c5d20ef202027280c434cc0f75b8a8117e7 /src/callback.c | |
parent | 23cea0103d4063d52a145d4872320ab7070e8ce2 (diff) | |
download | mpiosh-master.tar.gz mpiosh-master.tar.bz2 mpiosh-master.zip |
Ugly: mpiosh_command_regex_fix "reallocates" memory -- that's not your
job...
Diffstat (limited to 'src/callback.c')
-rw-r--r-- | src/callback.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/callback.c b/src/callback.c index df9b39d..fe17a31 100644 --- a/src/callback.c +++ b/src/callback.c @@ -641,7 +641,7 @@ mpiosh_cmd_dump(char *args[]) { BYTE *p; BYTE month, day, hour, minute, type; - CHAR fname[256]; + CHAR *fname; char *arg[2]; WORD year; DWORD fsize; @@ -654,8 +654,9 @@ mpiosh_cmd_dump(char *args[]) p = mpio_directory_open(mpiosh.dev, mpiosh.card); while ((p != NULL) && (!mpiosh_cancel)) { - arg[0] = fname; /* is this a memory leak?? -mager */ - memset(fname, '\0', 256); + /* memory is free'd/reallocated in mpiosh_command_regex_fix */ + fname = calloc (256, sizeof (*fname)); + arg[0] = fname; mpio_dentry_get(mpiosh.dev, mpiosh.card, p, fname, 256, @@ -665,7 +666,9 @@ mpiosh_cmd_dump(char *args[]) mpiosh_cmd_mget(arg); p = mpio_dentry_next(mpiosh.dev, mpiosh.card, p); - } + + free (arg[0]); + } } void |