File src/filetype.c changed (mode: 100644) (index 87cfb65aa..0aaba1863) |
... |
... |
ft_set_viewers(matchers_t *matchers, const char viewers[]) |
287 |
287 |
}; |
}; |
288 |
288 |
ft_assoc_records_free(&view_records); |
ft_assoc_records_free(&view_records); |
289 |
289 |
|
|
|
290 |
|
/* On error, add_assoc() frees assoc, so just exit then. */ |
290 |
291 |
(void)add_assoc(&fileviewers, assoc); |
(void)add_assoc(&fileviewers, assoc); |
291 |
292 |
} |
} |
292 |
293 |
|
|
|
... |
... |
clone_assoc_records(const assoc_records_t *records, const char pattern[], |
311 |
312 |
} |
} |
312 |
313 |
|
|
313 |
314 |
/* Adds association to the list of associations. Returns non-zero on |
/* Adds association to the list of associations. Returns non-zero on |
314 |
|
* out of memory error, otherwise zero is returned. */ |
|
|
315 |
|
* out of memory error, otherwise zero is returned. Frees resources of assoc |
|
316 |
|
* on error. */ |
315 |
317 |
static int |
static int |
316 |
318 |
add_assoc(assoc_list_t *assoc_list, assoc_t assoc) |
add_assoc(assoc_list_t *assoc_list, assoc_t assoc) |
317 |
319 |
{ |
{ |
|
... |
... |
add_assoc(assoc_list_t *assoc_list, assoc_t assoc) |
319 |
321 |
p = reallocarray(assoc_list->list, assoc_list->count + 1, sizeof(assoc_t)); |
p = reallocarray(assoc_list->list, assoc_list->count + 1, sizeof(assoc_t)); |
320 |
322 |
if(p == NULL) |
if(p == NULL) |
321 |
323 |
{ |
{ |
|
324 |
|
free_assoc(&assoc); |
322 |
325 |
show_error_msg("Memory Error", "Unable to allocate enough memory"); |
show_error_msg("Memory Error", "Unable to allocate enough memory"); |
323 |
326 |
return 1; |
return 1; |
324 |
327 |
} |
} |