[xiph-commits] r12681 - trunk/ezstream/src

moritz at svn.xiph.org moritz at svn.xiph.org
Thu Mar 8 07:25:36 PST 2007


Author: moritz
Date: 2007-03-08 07:25:33 -0800 (Thu, 08 Mar 2007)
New Revision: 12681

Modified:
   trunk/ezstream/src/ezstream.c
   trunk/ezstream/src/metadata.c
   trunk/ezstream/src/metadata.h
Log:
Hmph. I've been stepping into the copy-of-pointer trap twice now. Fix it again.


Modified: trunk/ezstream/src/ezstream.c
===================================================================
--- trunk/ezstream/src/ezstream.c	2007-03-08 14:39:00 UTC (rev 12680)
+++ trunk/ezstream/src/ezstream.c	2007-03-08 15:25:33 UTC (rev 12681)
@@ -297,12 +297,12 @@
 	}
 
 	if (!metadata_file_update(mdata)) {
-		metadata_free(mdata);
+		metadata_free(&mdata);
 		songInfo = xstrdup(blankString);
 		return (songInfo);
 	}
 	songInfo = xstrdup(metadata_get_string(mdata));
-	metadata_free(mdata);
+	metadata_free(&mdata);
 
 	if ((shout_mdata = shout_metadata_new()) == NULL) {
 		printf("%s: shout_metadata_new(): %s\n", __progname,

Modified: trunk/ezstream/src/metadata.c
===================================================================
--- trunk/ezstream/src/metadata.c	2007-03-08 14:39:00 UTC (rev 12680)
+++ trunk/ezstream/src/metadata.c	2007-03-08 15:25:33 UTC (rev 12681)
@@ -337,7 +337,7 @@
 
 	md = metadata_create(filename);
 	if (!metadata_file_update(md)) {
-		metadata_free(md);
+		metadata_free(&md);
 		return (NULL);
 	}
 
@@ -362,15 +362,19 @@
 }
 
 void
-metadata_free(metadata_t *md)
+metadata_free(metadata_t **md)
 {
-	if (md == NULL)
+	metadata_t	*tmp;
+
+	if (md == NULL || *md == NULL)
 		return;
 
-	if (md->filename != NULL)
-		xfree(md->filename);
-	metadata_clean_md(md);
-	xfree(md);
+	tmp = *md;
+
+	if (tmp->filename != NULL)
+		xfree(tmp->filename);
+	metadata_clean_md(tmp);
+	xfree(*md);
 }
 
 

Modified: trunk/ezstream/src/metadata.h
===================================================================
--- trunk/ezstream/src/metadata.h	2007-03-08 14:39:00 UTC (rev 12680)
+++ trunk/ezstream/src/metadata.h	2007-03-08 15:25:33 UTC (rev 12681)
@@ -59,7 +59,7 @@
  * Free all memory used by a metadata handle that has been created with
  * metadata_file() or metadata_program().
  */
-void		metadata_free(metadata_t *);
+void		metadata_free(metadata_t **);
 
 /*
  * Update/read the metadata for the given handle. Returns 1 on success, and 0



More information about the commits mailing list