Yet another valgrind-found memory leak.

This commit is contained in:
rocky
2004-03-21 03:43:06 +00:00
parent 5475093981
commit fdd55c4e6e

View File

@@ -1,5 +1,5 @@
/* /*
$Id: cdio.c,v 1.42 2004/03/20 22:46:57 rocky Exp $ $Id: cdio.c,v 1.43 2004/03/21 03:43:06 rocky Exp $
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
@@ -37,7 +37,7 @@
#include <cdio/logging.h> #include <cdio/logging.h>
#include "cdio_private.h" #include "cdio_private.h"
static const char _rcsid[] = "$Id: cdio.c,v 1.42 2004/03/20 22:46:57 rocky Exp $"; static const char _rcsid[] = "$Id: cdio.c,v 1.43 2004/03/21 03:43:06 rocky Exp $";
const char *track_format2str[6] = const char *track_format2str[6] =
@@ -336,17 +336,20 @@ cdio_get_devices_with_cap (char* search_devices[],
if (capabilities == CDIO_FS_MATCH_ALL) { if (capabilities == CDIO_FS_MATCH_ALL) {
/* Duplicate drives into drives_ret. */ /* Duplicate drives into drives_ret. */
for( ; *drives != NULL; drives++ ) { char **d = drives;
cdio_add_device_list(&drives_ret, *drives, &num_drives);
for( ; *d != NULL; d++ ) {
cdio_add_device_list(&drives_ret, *d, &num_drives);
} }
} else { } else {
cdio_fs_anal_t got_fs=0; cdio_fs_anal_t got_fs=0;
cdio_fs_anal_t need_fs = CDIO_FSTYPE(capabilities); cdio_fs_anal_t need_fs = CDIO_FSTYPE(capabilities);
cdio_fs_anal_t need_fs_ext; cdio_fs_anal_t need_fs_ext;
char **d = drives;
need_fs_ext = capabilities & ~CDIO_FS_MASK; need_fs_ext = capabilities & ~CDIO_FS_MASK;
for( ; *drives != NULL; drives++ ) { for( ; *d != NULL; d++ ) {
CdIo *cdio = cdio_open(*drives, DRIVER_UNKNOWN); CdIo *cdio = cdio_open(*d, DRIVER_UNKNOWN);
if (NULL != cdio) { if (NULL != cdio) {
track_t first_track = cdio_get_first_track_num(cdio); track_t first_track = cdio_get_first_track_num(cdio);
@@ -368,6 +371,8 @@ cdio_get_devices_with_cap (char* search_devices[],
} }
} }
cdio_add_device_list(&drives_ret, NULL, &num_drives); cdio_add_device_list(&drives_ret, NULL, &num_drives);
cdio_free_device_list(drives);
free(drives);
return drives_ret; return drives_ret;
} }