From 76ad0a532b737b83727dfb08fa610ba7ced6c5bc Mon Sep 17 00:00:00 2001
From: Andrew Borodin <aborodin@vmail.ru>
Date: Thu, 26 Nov 2015 21:49:26 +0300
Subject: [PATCH] (configure_panel_listing): fix memory leaks.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
---
src/filemanager/cmd.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/src/filemanager/cmd.c b/src/filemanager/cmd.c
index 52c8c5e..0179aed 100644
a
|
b
|
nice_cd (const char *text, const char *xtext, const char *help, |
466 | 466 | /* --------------------------------------------------------------------------------------------- */ |
467 | 467 | |
468 | 468 | static void |
469 | | configure_panel_listing (WPanel * p, int list_type, int brief_cols, int use_msformat, char *user, |
470 | | char *status) |
| 469 | configure_panel_listing (WPanel * p, int list_type, int brief_cols, int use_msformat, char **user, |
| 470 | char **status) |
471 | 471 | { |
472 | 472 | p->user_mini_status = use_msformat; |
473 | 473 | p->list_type = list_type; |
… |
… |
configure_panel_listing (WPanel * p, int list_type, int brief_cols, int use_msfo |
477 | 477 | else if (list_type == list_user || use_msformat) |
478 | 478 | { |
479 | 479 | g_free (p->user_format); |
480 | | p->user_format = user; |
| 480 | p->user_format = *user; |
| 481 | *user = NULL; |
481 | 482 | |
482 | 483 | g_free (p->user_status_format[list_type]); |
483 | | p->user_status_format[list_type] = status; |
| 484 | p->user_status_format[list_type] = *status; |
| 485 | *status = NULL; |
484 | 486 | |
485 | 487 | set_panel_formats (p); |
486 | 488 | } |
487 | | else |
488 | | { |
489 | | g_free (user); |
490 | | g_free (status); |
491 | | } |
492 | 489 | |
493 | 490 | set_panel_formats (p); |
494 | 491 | do_refresh (); |
… |
… |
change_listing_cmd (void) |
1658 | 1655 | { |
1659 | 1656 | switch_to_listing (MENU_PANEL_IDX); |
1660 | 1657 | p = MENU_PANEL_IDX == 0 ? left_panel : right_panel; |
1661 | | configure_panel_listing (p, list_type, brief_cols, use_msformat, user, status); |
| 1658 | configure_panel_listing (p, list_type, brief_cols, use_msformat, &user, &status); |
| 1659 | g_free (user); |
| 1660 | g_free (status); |
1662 | 1661 | } |
1663 | 1662 | } |
1664 | 1663 | |