diff -u -r --show-c-function --exclude-from=amanda.diff amanda-2.5.0p2.orig/server-src/amcheck.c amanda-2.5.0p2.new/server-src/amcheck.c --- amanda-2.5.0p2.orig/server-src/amcheck.c 2006-05-12 15:26:12.000000000 -0400 +++ amanda-2.5.0p2.new/server-src/amcheck.c 2006-05-24 08:29:04.000000000 -0400 @@ -810,7 +810,7 @@ int start_server_check(fd, do_localchk, if (testtape) { /* check that the tape is a valid amanda tape */ - char *error_msg; + char *error_msg = NULL; int tape_status; tapedays = getconf_int(CNF_TAPECYCLE); @@ -824,8 +824,10 @@ int start_server_check(fd, do_localchk, tape_status = taper_scan(NULL, &label, &datestamp, &error_msg, &tapename); - fprintf(outf, "%s\n", error_msg); - amfree(error_msg); + if(error_msg) { + fprintf(outf, "%s\n", error_msg); + amfree(error_msg); + } if (tape_status < 0) { tape_t *exptape = lookup_last_reusable_tape(0); fprintf(outf, " (expecting "); diff -u -r --show-c-function --exclude-from=amanda.diff amanda-2.5.0p2.orig/server-src/taper.c amanda-2.5.0p2.new/server-src/taper.c --- amanda-2.5.0p2.orig/server-src/taper.c 2006-05-04 17:31:15.000000000 -0400 +++ amanda-2.5.0p2.new/server-src/taper.c 2006-05-24 08:33:31.000000000 -0400 @@ -2331,7 +2331,7 @@ int label_tape() char *result; static int first_call = 1; char *timestamp; - char *error_msg; + char *error_msg = NULL; char *s, *r; int slot = -1; @@ -2348,6 +2348,7 @@ int label_tape() if(r) { slot = atoi(r); } + amfree(error_msg); } if((tape_fd = tape_open(tapedev, O_WRONLY)) == -1) { if(errno == EACCES) {