Changeset cdb07b55d30df5aefda222f6e9f5099e6f5d8fd9
- Timestamp:
- 05/09/08 22:59:27
(4 months ago)
- Author:
- Rafaël Carré <funman@videolan.org>
- git-committer:
- Rafaël Carré <funman@videolan.org> 1210366767 +0200
- git-parent:
[3ad6ea967fe0ae37c01b6883599319e7ee37c0fc]
- git-author:
- Rafaël Carré <funman@videolan.org> 1210366745 +0200
- Message:
Fix memory leaks in ncurses intf
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rf772183 |
rcdb07b5 |
|
| 316 | 316 | { |
|---|
| 317 | 317 | p_sys->psz_current_dir = strdup( val.psz_string ); |
|---|
| 318 | | free( val.psz_string ); |
|---|
| 319 | 318 | } |
|---|
| 320 | 319 | else |
|---|
| … | … | |
| 322 | 321 | p_sys->psz_current_dir = strdup( p_intf->p_libvlc->psz_homedir ); |
|---|
| 323 | 322 | } |
|---|
| | 323 | |
|---|
| | 324 | free( val.psz_string ); |
|---|
| 324 | 325 | |
|---|
| 325 | 326 | p_sys->i_dir_entries = 0; |
|---|
| … | … | |
| 338 | 339 | intf_thread_t *p_intf = (intf_thread_t *)p_this; |
|---|
| 339 | 340 | intf_sys_t *p_sys = p_intf->p_sys; |
|---|
| 340 | | int i; |
|---|
| 341 | 341 | |
|---|
| 342 | 342 | PlaylistDestroy( p_intf ); |
|---|
| 343 | 343 | |
|---|
| 344 | | for( i = 0; i < p_sys->i_dir_entries; i++ ) |
|---|
| 345 | | { |
|---|
| 346 | | struct dir_entry_t *p_dir_entry = p_sys->pp_dir_entries[i]; |
|---|
| | 344 | while( p_sys->i_dir_entries ) |
|---|
| | 345 | { |
|---|
| | 346 | struct dir_entry_t *p_dir_entry = p_sys->pp_dir_entries[0]; |
|---|
| 347 | 347 | free( p_dir_entry->psz_path ); |
|---|
| 348 | | REMOVE_ELEM( p_sys->pp_dir_entries, p_sys->i_dir_entries, i ); |
|---|
| | 348 | REMOVE_ELEM( p_sys->pp_dir_entries, p_sys->i_dir_entries, 0 ); |
|---|
| 349 | 349 | free( p_dir_entry ); |
|---|
| 350 | 350 | } |
|---|
| … | … | |
| 1337 | 1337 | int i_len; |
|---|
| 1338 | 1338 | |
|---|
| | 1339 | if( w <= 0 ) |
|---|
| | 1340 | return; |
|---|
| | 1341 | |
|---|
| 1339 | 1342 | va_start( vl_args, p_fmt ); |
|---|
| 1340 | 1343 | if( vasprintf( &p_buf, p_fmt, vl_args ) == -1 ) |
|---|
| 1341 | 1344 | return; |
|---|
| 1342 | 1345 | va_end( vl_args ); |
|---|
| 1343 | | |
|---|
| 1344 | | if( ( p_buf == NULL ) || ( w <= 0 ) ) |
|---|
| 1345 | | return; |
|---|
| 1346 | 1346 | |
|---|
| 1347 | 1347 | i_len = strlen( p_buf ); |
|---|
| … | … | |
| 1356 | 1356 | |
|---|
| 1357 | 1357 | if( i_char_len == (size_t)-1 ) |
|---|
| 1358 | | /* an invalid character was encountered */ |
|---|
| | 1358 | /* an invalid character was encountered */ |
|---|
| | 1359 | { |
|---|
| | 1360 | free( p_buf ); |
|---|
| 1359 | 1361 | return; |
|---|
| | 1362 | } |
|---|
| 1360 | 1363 | else |
|---|
| 1361 | 1364 | { |
|---|
| … | … | |
| 1424 | 1427 | mvhline( y, x + i_width, ' ', w - i_width ); |
|---|
| 1425 | 1428 | } |
|---|
| | 1429 | |
|---|
| | 1430 | free( p_buf ); |
|---|
| 1426 | 1431 | #else |
|---|
| 1427 | 1432 | if( i_len > w ) |
|---|
| … | … | |
| 2130 | 2135 | |
|---|
| 2131 | 2136 | DrawBox( p_sys->w, y++, 0, h, COLS, psz_title, p_sys->b_color ); |
|---|
| | 2137 | free( psz_title ); |
|---|
| 2132 | 2138 | |
|---|
| 2133 | 2139 | if( p_sys->b_need_update || p_sys->pp_plist == NULL ) |
|---|
| … | … | |
| 2384 | 2390 | { |
|---|
| 2385 | 2391 | intf_sys_t *p_sys = p_intf->p_sys; |
|---|
| 2386 | | int i; |
|---|
| 2387 | | |
|---|
| 2388 | | for( i = 0; i < p_sys->i_plist_entries; i++ ) |
|---|
| 2389 | | { |
|---|
| 2390 | | struct pl_item_t *p_pl_item = p_sys->pp_plist[i]; |
|---|
| | 2392 | |
|---|
| | 2393 | while( p_sys->i_plist_entries ) |
|---|
| | 2394 | { |
|---|
| | 2395 | struct pl_item_t *p_pl_item = p_sys->pp_plist[0]; |
|---|
| 2391 | 2396 | free( p_pl_item->psz_display ); |
|---|
| 2392 | | REMOVE_ELEM( p_sys->pp_plist, p_sys->i_plist_entries, i ); |
|---|
| | 2397 | REMOVE_ELEM( p_sys->pp_plist, p_sys->i_plist_entries, 0 ); |
|---|
| 2393 | 2398 | free( p_pl_item ); |
|---|
| 2394 | 2399 | } |
|---|
| 2395 | 2400 | p_sys->pp_plist = NULL; |
|---|
| 2396 | | p_sys->i_plist_entries = 0; |
|---|
| 2397 | 2401 | } |
|---|
| 2398 | 2402 | |
|---|