Free malloc'd pointer.

This commit is contained in:
Svend Sorensen
2004-09-01 10:03:26 +00:00
parent f8538bf7c0
commit f1b2a8dd67

View File

@@ -96,7 +96,7 @@ void disc_field (char *conv, int length, Cd *cd)
printf(conv, cdtext_get(PTI_MESSAGE, cdtext)); printf(conv, cdtext_get(PTI_MESSAGE, cdtext));
break; break;
case 'N': case 'N':
*c = 'd'; *c = 'd'; /* tracks is an integer */
printf(conv, cd_get_ntrack(cd)); printf(conv, cd_get_ntrack(cd));
break; break;
case 'P': case 'P':
@@ -163,7 +163,7 @@ void track_field (char *conv, int length, Cd *cd, int trackno)
printf(conv, cdtext_get(PTI_MESSAGE, cdtext)); printf(conv, cdtext_get(PTI_MESSAGE, cdtext));
break; break;
case 'n': case 'n':
*c = 'd'; *c = 'd'; /* track number is an integer */
printf(conv, trackno); printf(conv, trackno);
break; break;
case 'p': case 'p':
@@ -205,15 +205,17 @@ void print_conv (char *start, int length, Cd *cd, int trackno)
disc_field(conv, length, cd); disc_field(conv, length, cd);
else else
track_field(conv, length, cd, trackno); track_field(conv, length, cd, trackno);
free(conv);
} }
/* print an escaped character /* print an single-character escape
* `c' is the character after the `/' * `c' is the character after the `/'
* NOTE: this does not handle octal and hexidecimal escapes * NOTE: this does not handle octal and hexidecimal escapes
* except for \0
*/ */
int print_esc (char *c) int print_esc (char *c)
{ {
/* ?, ', " are handled by the default */
switch (*c) { switch (*c) {
case 'a': case 'a':
putchar('\a'); putchar('\a');
@@ -240,6 +242,7 @@ int print_esc (char *c)
putchar('\0'); putchar('\0');
break; break;
default: default:
/* ?, ', " are handled by the default */
putchar(*c); putchar(*c);
break; break;
} }