~ruther/CTU-FEE-B0B35APO-Semestral-project

12a1bb939be832e654a94553ee6dfa30deb6abd0 — František Boháček 3 years ago 300afb3
fix: malloc error handling
1 files changed, 3 insertions(+), 0 deletions(-)

M file-browser/src/path.c
M file-browser/src/path.c => file-browser/src/path.c +3 -0
@@ 17,6 17,9 @@ char *path_join(char *base, char *relative) {

  size_t new_len = base_len + relative_len + 1; // length of the string
  char *out = malloc((new_len + 1) * sizeof(out)); // length of the string plus one for \0
  if (out == NULL) {
    return NULL;
  }
  out[new_len] = '\0';
  out[base_len] = '/';


Do not follow this link