Browse Source

fix bug no. 484, correct TREALLOC usage

pre-master-46
Holger Vogt 6 years ago
parent
commit
a7e664a5c2
  1. 4
      src/misc/tilde.c

4
src/misc/tilde.c

@ -54,7 +54,7 @@ char *tildexpand(const char *string)
return copy(string); /* Strip the ~ and return the rest */ return copy(string); /* Strip the ~ and return the rest */
} }
const size_t n_char_rest = strlen(string); const size_t n_char_rest = strlen(string);
TREALLOC(char, sz_home, (size_t) n_char_home + n_char_rest + 1);
sz_home = TREALLOC(char, sz_home, (size_t) n_char_home + n_char_rest + 1);
strcpy(sz_home + n_char_home, string); strcpy(sz_home + n_char_home, string);
return sz_home; return sz_home;
} }
@ -88,7 +88,7 @@ char *tildexpand(const char *string)
return copy(usr_start); /* Strip the ~ and return the rest */ return copy(usr_start); /* Strip the ~ and return the rest */
} }
const size_t n_char_rest = strlen(string); const size_t n_char_rest = strlen(string);
TREALLOC(char, sz_home, (size_t) n_char_home + n_char_rest + 1);
sz_home = TREALLOC(char, sz_home, (size_t) n_char_home + n_char_rest + 1);
strcpy(sz_home + n_char_home, string); strcpy(sz_home + n_char_home, string);
return sz_home; return sz_home;
} }

Loading…
Cancel
Save