#define EXT_TIPO3_DISP ".fsc"
#define EXT_TIPO3_IDS ".ids"
+char *str_dup(const char *s);
+
char *str_dup(const char *s)
{
+ char *tmp;
if (s == NULL) return NULL;
- char *tmp = (char *)malloc(sizeof(char)*(strlen(s)+1));
+ tmp = (char *)malloc(sizeof(char)*(strlen(s)+1));
strcpy(tmp, s);
return tmp;
}
strcpy(name, filename);
strcat(name, EXT_TIPO3_DATA);
+
+ /* Trato de determinar el tipo de archivo */
fp = fopen(name, "r");
if (fp == NULL) return NULL;
fread(&tipo, sizeof(char), 1, fp);
}
tmp = (EMUFS *)malloc(sizeof(EMUFS));
- if (tmp == NULL) return NULL;
+ if (tmp == NULL) {
+ fclose(fp);
+ return NULL;
+ }
switch (tipo) {
case T1: