[xiph-cvs] cvs commit: vorbis-tools/vorbiscomment vcedit.c vcomment.c
Michael Smith
msmith at xiph.org
Tue Jul 9 05:44:55 PDT 2002
msmith 02/07/09 05:44:55
Modified: vorbiscomment vcedit.c vcomment.c
Log:
More memory leaks plugged. And this version works, too.
Revision Changes Path
1.20 +12 -6 vorbis-tools/vorbiscomment/vcedit.c
Index: vcedit.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/vorbiscomment/vcedit.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- vcedit.c 2002/07/09 12:20:43 1.19
+++ vcedit.c 2002/07/09 12:44:54 1.20
@@ -6,12 +6,13 @@
*
* Comment editing backend, suitable for use by nice frontend interfaces.
*
- * last modified: $Id: vcedit.c,v 1.19 2002/07/09 12:20:43 msmith Exp $
+ * last modified: $Id: vcedit.c,v 1.20 2002/07/09 12:44:54 msmith Exp $
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <errno.h>
#include <ogg/ogg.h>
#include <vorbis/codec.h>
@@ -441,7 +442,8 @@
while(1)
{
result = ogg_sync_pageout(state->oy, &ogout);
- if(result==0) break;
+ if(result==0)
+ break;
if(result<0)
state->lasterror = _("Corrupt or missing data, continuing...");
else
@@ -449,11 +451,15 @@
/* Don't bother going through the rest, we can just
* write the page out now */
if(state->write(ogout.header,1,ogout.header_len,
- out) != (size_t) ogout.header_len)
+ out) != (size_t) ogout.header_len) {
+ fprintf(stderr, "Bumming out\n");
goto cleanup;
+ }
if(state->write(ogout.body,1,ogout.body_len, out) !=
- (size_t) ogout.body_len)
+ (size_t) ogout.body_len) {
+ fprintf(stderr, "Bumming out 2\n");
goto cleanup;
+ }
}
}
buffer = ogg_sync_buffer(state->oy, CHUNKSIZE);
@@ -473,11 +479,11 @@
free(state->mainbuf);
free(state->bookbuf);
+ state->mainbuf = state->bookbuf = NULL;
- vcedit_clear_internals(state);
if(!state->eosin)
{
- state->lasterror =
+ state->lasterror =
_("Error writing stream to output. "
"Output stream may be corrupted or truncated.");
return -1;
<p><p>1.25 +6 -0 vorbis-tools/vorbiscomment/vcomment.c
Index: vcomment.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/vorbiscomment/vcomment.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- vcomment.c 2002/03/30 14:40:59 1.24
+++ vcomment.c 2002/07/09 12:44:54 1.25
@@ -102,7 +102,9 @@
{
fprintf(stderr, _("Failed to open file as vorbis: %s\n"),
vcedit_error(state));
+ close_files(param);
free_param(param);
+ vcedit_clear(state);
return 1;
}
@@ -126,7 +128,9 @@
{
fprintf(stderr, _("Failed to open file as vorbis: %s\n"),
vcedit_error(state));
+ close_files(param);
free_param(param);
+ vcedit_clear(state);
return 1;
}
@@ -165,7 +169,9 @@
{
fprintf(stderr, _("Failed to write comments to output file: %s\n"),
vcedit_error(state));
+ close_files(param);
free_param(param);
+ vcedit_clear(state);
return 1;
}
<p><p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list