NOTE: Since the 'cache_name' and 'tmp_name' pointers move inside the
corresponding cached strings, separate cache buffers are needed.
-static char *cache_name;
-static char *tmp_name;
+static char CacheName[PATH_MAX];
+static char *cache_name = CacheName;
+static char TmpName[PATH_MAX];
+static char *tmp_name = TmpName;
static int
unpack_iso(char *dir, char *iso)
static int
unpack_iso(char *dir, char *iso)
- cache_name = malloc(PATH_MAX);
- tmp_name = malloc(PATH_MAX);
strcpy(cache_name, opt_dir);
if (cleanable(opt_dir))
strcat(cache_name, ALT_PATH_STR CACHEFILE);
strcpy(cache_name, opt_dir);
if (cleanable(opt_dir))
strcat(cache_name, ALT_PATH_STR CACHEFILE);
{
FILE *fr;
LIST_MEMBER *pentry;
{
FILE *fr;
LIST_MEMBER *pentry;
+ char Line[LINESIZE + 1];
- Line = malloc(LINESIZE + 1);
- if (!Line)
- {
- l2l_dbg(1, "Alloc Line failed\n");
- return 1;
- }
Line[LINESIZE] = '\0';
fr = fopen(cache_name, "r");
if (!fr)
{
l2l_dbg(1, "Open %s failed\n", cache_name);
Line[LINESIZE] = '\0';
fr = fopen(cache_name, "r");
if (!fr)
{
l2l_dbg(1, "Open %s failed\n", cache_name);
return 2;
}
cache.phead = cache.ptail = NULL;
return 2;
}
cache.phead = cache.ptail = NULL;
create_cache(int force, int skipImageBase)
{
FILE *fr, *fw;
create_cache(int force, int skipImageBase)
{
FILE *fr, *fw;
- char *Line = NULL, *Fname = NULL;
+ char Line[LINESIZE + 1], *Fname = NULL;
int len, err;
size_t ImageBase;
int len, err;
size_t ImageBase;
- Line = malloc(LINESIZE + 1);
- if (!Line)
- return 1;
Line[LINESIZE] = '\0';
remove(tmp_name);
Line[LINESIZE] = '\0';
remove(tmp_name);
l2l_dbg(0, "Cannot list directory %s\n", opt_dir);
l2l_dbg(1, "Failed to execute: '%s'\n", Line);
remove(tmp_name);
l2l_dbg(0, "Cannot list directory %s\n", opt_dir);
l2l_dbg(1, "Failed to execute: '%s'\n", Line);
remove(tmp_name);
return 2;
}
l2l_dbg(0, "Creating cache ...");
return 2;
}
l2l_dbg(0, "Creating cache ...");
fclose(fr);
}
remove(tmp_name);
fclose(fr);
}
remove(tmp_name);
static int
translate_files(FILE *inFile, FILE *outFile)
{
static int
translate_files(FILE *inFile, FILE *outFile)
{
- char *Line = malloc(LINESIZE + 1);
- char *path = malloc(LINESIZE + 1);
- char *LineOut = malloc(LINESIZE + 1);
+ char Line[LINESIZE + 1];
+ char path[LINESIZE + 1];
+ char LineOut[LINESIZE + 1];
int c;
unsigned char ch;
int i = 0;
int c;
unsigned char ch;
int i = 0;
const char *p = kdbg_prompt;
const char *p_eos = p + sizeof(KDBG_PROMPT) - 1; //end of string pos
const char *p = kdbg_prompt;
const char *p_eos = p + sizeof(KDBG_PROMPT) - 1; //end of string pos
- if (Line && path && LineOut)
- {
memset(Line, '\0', LINESIZE + 1);
if (opt_console)
{
memset(Line, '\0', LINESIZE + 1);
if (opt_console)
{
log(outFile, "%s", Line);
}
}
log(outFile, "%s", Line);
}
}
if (opt_Revision && (strstr(opt_Revision, "regscan") == opt_Revision))
{
if (opt_Revision && (strstr(opt_Revision, "regscan") == opt_Revision))
{
if (logFile)
stat_print(logFile, &summ);
}
if (logFile)
stat_print(logFile, &summ);
}
- free(LineOut);
- free(Line);
- free(path);