Skip to content

Commit 7144438

Browse files
committed
Use automatic cleanup
1 parent c03e488 commit 7144438

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

zathura/synctex.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -330,16 +330,16 @@ bool synctex_view(zathura_t* zathura, const char* input_file, unsigned int line,
330330
zathura_document_t* document = zathura_get_document(zathura);
331331
const unsigned int number_of_pages = zathura_document_get_number_of_pages(document);
332332

333-
unsigned int page = 0;
334-
girara_list_t* secondary_rects = NULL;
333+
unsigned int page = 0;
334+
g_autoptr(girara_list_t) secondary_rects = NULL;
335335
girara_list_t* rectangles = synctex_rectangles_from_position(zathura, zathura_document_get_path(document), input_file,
336336
line, column, &page, &secondary_rects);
337337

338338
if (rectangles == NULL) {
339339
return false;
340340
}
341341

342-
girara_list_t** all_rectangles = g_try_malloc0(number_of_pages * sizeof(girara_list_t*));
342+
g_autofree girara_list_t** all_rectangles = g_try_malloc0(number_of_pages * sizeof(girara_list_t*));
343343
if (all_rectangles == NULL) {
344344
girara_list_free(rectangles);
345345
return false;
@@ -359,8 +359,5 @@ bool synctex_view(zathura_t* zathura, const char* input_file, unsigned int line,
359359

360360
synctex_highlight_rects(zathura, page, all_rectangles);
361361

362-
girara_list_free(secondary_rects);
363-
g_free(all_rectangles);
364-
365362
return true;
366363
}

0 commit comments

Comments
 (0)