More valgrind-found memory leaks. (More to come...)

This commit is contained in:
rocky
2004-02-07 18:53:02 +00:00
parent c090e7ee81
commit 6952d172e7
9 changed files with 44 additions and 23 deletions

View File

@@ -1,5 +1,5 @@
/* /*
$Id: _cdio_bincue.c,v 1.38 2004/01/09 02:42:39 rocky Exp $ $Id: _cdio_bincue.c,v 1.39 2004/02/07 18:53:02 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -24,7 +24,7 @@
(*.cue). (*.cue).
*/ */
static const char _rcsid[] = "$Id: _cdio_bincue.c,v 1.38 2004/01/09 02:42:39 rocky Exp $"; static const char _rcsid[] = "$Id: _cdio_bincue.c,v 1.39 2004/02/07 18:53:02 rocky Exp $";
#include "cdio_assert.h" #include "cdio_assert.h"
#include "cdio_private.h" #include "cdio_private.h"
@@ -580,7 +580,7 @@ _cdio_bincue_free (void *env) {
if (NULL == _obj) return; if (NULL == _obj) return;
free_if_notnull(_obj->mcn); free_if_notnull(_obj->mcn);
cdio_generic_stream_free(_obj); cdio_generic_stdio_free(_obj);
} }
/*! /*!
@@ -917,6 +917,7 @@ cdio_open_bincue (const char *source_name)
char *bin_name = cdio_is_cuefile(source_name); char *bin_name = cdio_is_cuefile(source_name);
if (NULL != bin_name) { if (NULL != bin_name) {
free(bin_name);
return cdio_open_cue(source_name); return cdio_open_cue(source_name);
} else { } else {
char *cue_name = cdio_is_binfile(source_name); char *cue_name = cdio_is_binfile(source_name);
@@ -950,7 +951,7 @@ cdio_open_cue (const char *cue_name)
if (_cdio_init(_data)) { if (_cdio_init(_data)) {
return ret; return ret;
} else { } else {
cdio_generic_stream_free (_data); cdio_generic_stdio_free (_data);
return NULL; return NULL;
} }
} }

View File

@@ -1,5 +1,5 @@
/* /*
$Id: _cdio_generic.c,v 1.11 2003/09/28 17:14:20 rocky Exp $ $Id: _cdio_generic.c,v 1.12 2004/02/07 18:53:02 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2002,2003 Rocky Bernstein <rocky@panix.com> Copyright (C) 2002,2003 Rocky Bernstein <rocky@panix.com>
@@ -27,7 +27,7 @@
# include "config.h" # include "config.h"
#endif #endif
static const char _rcsid[] = "$Id: _cdio_generic.c,v 1.11 2003/09/28 17:14:20 rocky Exp $"; static const char _rcsid[] = "$Id: _cdio_generic.c,v 1.12 2004/02/07 18:53:02 rocky Exp $";
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@@ -126,7 +126,7 @@ cdio_generic_read (void *user_data, void *buf, size_t size)
Release and free resources associated with stream or disk image. Release and free resources associated with stream or disk image.
*/ */
void void
cdio_generic_stream_free (void *user_data) cdio_generic_stdio_free (void *user_data)
{ {
generic_img_private_t *_obj = user_data; generic_img_private_t *_obj = user_data;
@@ -134,7 +134,7 @@ cdio_generic_stream_free (void *user_data)
free (_obj->source_name); free (_obj->source_name);
if (_obj->data_source) if (_obj->data_source)
cdio_stream_destroy (_obj->data_source); cdio_stdio_destroy (_obj->data_source);
free (_obj); free (_obj);
} }

View File

@@ -1,5 +1,5 @@
/* /*
$Id: _cdio_nrg.c,v 1.30 2004/02/01 15:53:06 rocky Exp $ $Id: _cdio_nrg.c,v 1.31 2004/02/07 18:53:02 rocky Exp $
Copyright (C) 2001,2003 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2001,2003 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
@@ -48,7 +48,7 @@
#include "cdio_private.h" #include "cdio_private.h"
#include "_cdio_stdio.h" #include "_cdio_stdio.h"
static const char _rcsid[] = "$Id: _cdio_nrg.c,v 1.30 2004/02/01 15:53:06 rocky Exp $"; static const char _rcsid[] = "$Id: _cdio_nrg.c,v 1.31 2004/02/07 18:53:02 rocky Exp $";
/* structures used */ /* structures used */
@@ -1092,7 +1092,7 @@ cdio_open_nrg (const char *source_name)
cdio_funcs _funcs = { cdio_funcs _funcs = {
.eject_media = cdio_generic_bogus_eject_media, .eject_media = cdio_generic_bogus_eject_media,
.free = cdio_generic_stream_free, .free = cdio_generic_stdio_free,
.get_arg = _cdio_get_arg, .get_arg = _cdio_get_arg,
.get_devices = cdio_get_devices_nrg, .get_devices = cdio_get_devices_nrg,
.get_default_device = cdio_get_default_device_nrg, .get_default_device = cdio_get_default_device_nrg,
@@ -1131,7 +1131,7 @@ cdio_open_nrg (const char *source_name)
if (_cdio_init(_data)) if (_cdio_init(_data))
return ret; return ret;
else { else {
cdio_generic_stream_free (_data); cdio_generic_stdio_free (_data);
return NULL; return NULL;
} }

View File

@@ -1,5 +1,5 @@
/* /*
$Id: _cdio_stdio.c,v 1.5 2004/01/10 03:03:08 rocky Exp $ $Id: _cdio_stdio.c,v 1.6 2004/02/07 18:53:02 rocky Exp $
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -35,7 +35,7 @@
#include "_cdio_stream.h" #include "_cdio_stream.h"
#include "_cdio_stdio.h" #include "_cdio_stdio.h"
static const char _rcsid[] = "$Id: _cdio_stdio.c,v 1.5 2004/01/10 03:03:08 rocky Exp $"; static const char _rcsid[] = "$Id: _cdio_stdio.c,v 1.6 2004/02/07 18:53:02 rocky Exp $";
#define CDIO_STDIO_BUFSIZE (128*1024) #define CDIO_STDIO_BUFSIZE (128*1024)
@@ -171,6 +171,15 @@ _stdio_read(void *user_data, void *buf, long int count)
return read; return read;
} }
/*!
Deallocate resources assocaited with obj. After this obj is unusable.
*/
void
cdio_stdio_destroy(CdioDataSource *obj)
{
cdio_stream_destroy(obj);
}
CdioDataSource* CdioDataSource*
cdio_stdio_new(const char pathname[]) cdio_stdio_new(const char pathname[])
{ {

View File

@@ -1,5 +1,5 @@
/* /*
$Id: _cdio_stdio.h,v 1.2 2004/01/10 03:03:08 rocky Exp $ $Id: _cdio_stdio.h,v 1.3 2004/02/07 18:53:02 rocky Exp $
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
@@ -34,6 +34,12 @@
*/ */
CdioDataSource* cdio_stdio_new(const char pathname[]); CdioDataSource* cdio_stdio_new(const char pathname[]);
/*!
Deallocate resources assocaited with obj. After this obj is unusable.
*/
void cdio_stdio_destroy(CdioDataSource *obj);
#endif /* __CDIO_STREAM_STDIO_H__ */ #endif /* __CDIO_STREAM_STDIO_H__ */

View File

@@ -1,5 +1,5 @@
/* /*
$Id: _cdio_stream.c,v 1.8 2004/01/10 03:03:08 rocky Exp $ $Id: _cdio_stream.c,v 1.9 2004/02/07 18:53:02 rocky Exp $
Copyright (C) 2000, 2004 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2000, 2004 Herbert Valerio Riedel <hvr@gnu.org>
@@ -34,7 +34,7 @@
#include <cdio/util.h> #include <cdio/util.h>
#include "_cdio_stream.h" #include "_cdio_stream.h"
static const char _rcsid[] = "$Id: _cdio_stream.c,v 1.8 2004/01/10 03:03:08 rocky Exp $"; static const char _rcsid[] = "$Id: _cdio_stream.c,v 1.9 2004/02/07 18:53:02 rocky Exp $";
/* /*
* DataSource implementations * DataSource implementations
@@ -186,6 +186,8 @@ cdio_stream_destroy(CdioDataSource* obj)
cdio_stream_close(obj); cdio_stream_close(obj);
obj->op.free(obj->user_data); obj->op.free(obj->user_data);
free(obj);
} }

View File

@@ -1,5 +1,5 @@
/* /*
$Id: _cdio_stream.h,v 1.7 2004/01/10 03:03:08 rocky Exp $ $Id: _cdio_stream.h,v 1.8 2004/02/07 18:53:02 rocky Exp $
Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2000 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -104,6 +104,9 @@ extern "C" {
*/ */
long int cdio_stream_stat(CdioDataSource* obj); long int cdio_stream_stat(CdioDataSource* obj);
/*!
Deallocate resources assocaited with obj. After this obj is unusable.
*/
void cdio_stream_destroy(CdioDataSource* obj); void cdio_stream_destroy(CdioDataSource* obj);
void cdio_stream_close(CdioDataSource* obj); void cdio_stream_close(CdioDataSource* obj);

View File

@@ -1,5 +1,5 @@
/* /*
$Id: cdio_private.h,v 1.17 2003/09/30 03:26:11 rocky Exp $ $Id: cdio_private.h,v 1.18 2004/02/07 18:53:02 rocky Exp $
Copyright (C) 2003 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003 Rocky Bernstein <rocky@panix.com>
@@ -275,7 +275,7 @@ extern "C" {
/*! /*!
Release and free resources associated with stream or disk image. Release and free resources associated with stream or disk image.
*/ */
void cdio_generic_stream_free (void *env); void cdio_generic_stdio_free (void *env);
/*! /*!
Return true if source_name could be a device containing a CD-ROM on Return true if source_name could be a device containing a CD-ROM on

View File

@@ -1,5 +1,5 @@
/* /*
$Id: iso9660_fs.c,v 1.15 2004/01/10 03:21:50 rocky Exp $ $Id: iso9660_fs.c,v 1.16 2004/02/07 18:53:02 rocky Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org> Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
@@ -40,7 +40,7 @@
#include <stdio.h> #include <stdio.h>
static const char _rcsid[] = "$Id: iso9660_fs.c,v 1.15 2004/01/10 03:21:50 rocky Exp $"; static const char _rcsid[] = "$Id: iso9660_fs.c,v 1.16 2004/02/07 18:53:02 rocky Exp $";
/* Implementation of iso9660_t type */ /* Implementation of iso9660_t type */
struct _iso9660 { struct _iso9660 {
@@ -79,7 +79,7 @@ bool
iso9660_close (iso9660_t *iso) iso9660_close (iso9660_t *iso)
{ {
if (NULL != iso) { if (NULL != iso) {
cdio_stream_destroy(iso->stream); cdio_stdio_destroy(iso->stream);
free(iso); free(iso);
} }
return true; return true;