Changeset 2334 in MondoRescue for branches/2.2.10/mondo/src/common


Ignore:
Timestamp:
Aug 18, 2009, 5:28:18 PM (15 years ago)
Author:
Bruno Cornec
Message:

r3369@localhost: bruno | 2009-08-18 16:57:27 +0200

  • Transform bout 100 strcpy in dyn. allocation. Quality is improving
  • function figure_out_kernel_path_interactively_if_necessary now return a dynamically allocated string
  • mondoarchive checked with valgrind in text an newt modes
Location:
branches/2.2.10/mondo/src/common
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mondo/src/common/libmondo-archive-EXT.h

    r1885 r2334  
    1010extern int do_that_initial_phase();
    1111extern int do_that_final_phase();
    12 extern int figure_out_kernel_path_interactively_if_necessary(char *kernel);
     12extern char *figure_out_kernel_path_interactively_if_necessary(void);
    1313extern int make_those_slices_phase();
    1414extern int make_those_afios_phase();
  • branches/2.2.10/mondo/src/common/libmondo-archive.c

    r2331 r2334  
    441441
    442442    copy_mondo_and_mindi_stuff_to_scratchdir(); // payload, too, if it exists
     443    mr_free(bkpinfo->kernel_path);
    443444#if __FreeBSD__ == 5
    444445    mr_asprintf(bkpinfo->kernel_path, "/boot/kernel/kernel");
     
    446447    mr_asprintf(bkpinfo->kernel_path, "/kernel");
    447448#elif linux
    448     if (figure_out_kernel_path_interactively_if_necessary(bkpinfo->kernel_path)) {
     449    if ((bkpinfo->kernel_path = figure_out_kernel_path_interactively_if_necessary()) == NULL) {
    449450        fatal_error("Kernel not found. Please specify manually with the '-k' switch.");
    450451    }
     
    854855            use_gzip_sz);       // parameter #20 (STRING)
    855856
     857    mr_free(tmp2);
    856858    mr_free(devs_to_exclude);
    857859    mr_free(last_filelist_number);
  • branches/2.2.10/mondo/src/common/libmondo-archive.h

    r1885 r2334  
    1111int do_that_initial_phase();
    1212int do_that_final_phase();
    13 int figure_out_kernel_path_interactively_if_necessary(char *kernel);
     13char *figure_out_kernel_path_interactively_if_necessary(void);
    1414bool get_bit_N_of_array(char *array, int N);
    1515int make_those_slices_phase();
  • branches/2.2.10/mondo/src/common/libmondo-cli.c

    r2332 r2334  
    886886    if ((flag_set['t'] && !flag_set['d']) && (! bkpinfo->restore_data)) {
    887887        log_it("Hmm! No tape drive specified. Let's see what we can do.");
    888         if ((tmp1 = find_tape_device_and_size(NULL)) == NULL) {
     888        if ((tmp1 = mr_find_tape_device()) == NULL) {
    889889            fatal_error("Tape device not specified. I couldn't find it either.");
    890890        }
     
    11911191
    11921192    if (flag_set['x']) {
    1193         mr_asprintf(bkpinfo->image_devs, flag_val['x']);
     1193        mr_asprintf(bkpinfo->image_devs, "%s", flag_val['x']);
    11941194        if ((run_program_and_log_output("which ntfsclone", 2)) && (! bkpinfo->restore_data)) {
    11951195            fatal_error("Please install ntfsprogs package/tarball.");
     
    12021202
    12031203    if ((flag_set['k']) && (! bkpinfo->restore_data)) {
     1204        mr_free(bkpinfo->kernel_path);
    12041205        mr_asprintf(bkpinfo->kernel_path, "%s", flag_val['k']);
    12051206        if (!strcmp(bkpinfo->kernel_path, "failsafe")) {
     
    15521553    case SIGKILL:
    15531554        mr_asprintf(tmp, "SIGKILL");
    1554         mr_asprintf(tmp2,
    1555                "I seriously have no clue how this signal even got to me. Something's wrong with your system.");
     1555        mr_asprintf(tmp2, "I seriously have no clue how this signal even got to me. Something's wrong with your system.");
    15561556        break;
    15571557    case SIGTERM:
     
    15651565    case SIGSEGV:
    15661566        mr_asprintf(tmp, "SIGSEGV");
    1567         mr_asprintf(tmp2,
    1568                "Internal programming error. Please send a backtrace as well as your log.");
     1567        mr_asprintf(tmp2, "Internal programming error. Please send a backtrace as well as your log.");
    15691568        break;
    15701569    case SIGPIPE:
  • branches/2.2.10/mondo/src/common/libmondo-devices.c

    r2332 r2334  
    131131    mr_free(tmp);
    132132
    133     if (is_this_a_ramdisk) {
    134         if (!does_file_exist("/THIS-IS-A-RAMDISK")) {
    135             log_to_screen("Using /dev/root is stupid of you but I'll forgive you.");
    136             is_this_a_ramdisk = FALSE;
    137         }
    138     }
    139     if (does_file_exist("/THIS-IS-A-RAMDISK")) {
    140         is_this_a_ramdisk = TRUE;
    141     }
    142133    log_msg(1, "Is this a ramdisk? result = %s", (is_this_a_ramdisk) ? "TRUE" : "FALSE");
    143134    return (is_this_a_ramdisk);
     
    515506
    516507    if (g_cdrw_drive_is_here[0]) {
    517         mr_asprintf(cdrw_device, g_cdrw_drive_is_here);
     508        mr_asprintf(cdrw_device, "%s", g_cdrw_drive_is_here);
    518509        log_msg(3, "Been there, done that. Returning %s", cdrw_device);
    519510        return(cdrw_device);
     
    840831
    841832    if (g_dvd_drive_is_here[0]) {
    842         mr_asprintf(output, g_dvd_drive_is_here);
     833        mr_asprintf(output, "%s", g_dvd_drive_is_here);
    843834        log_msg(3, "Been there, done that. Returning %s", output);
    844835        return (output);
     
    15991590
    16001591        mr_free(bkpinfo->media_device);
    1601         if ((!bkpinfo->restore_mode) && ((bkpinfo->media_device = find_tape_device_and_size(NULL)) == NULL)) {
     1592        if ((!bkpinfo->restore_mode) && ((bkpinfo->media_device = mr_find_tape_device()) == NULL)) {
    16021593            log_msg(3, "Ok, using vanilla scsi tape.");
    16031594            mr_asprintf(bkpinfo->media_device, "%s", VANILLA_SCSI_TAPE);
     
    16411632        mr_free(tmp);
    16421633
    1643         bkpinfo->use_obdr = ask_me_yes_or_no
    1644             ("Do you want to activate OBDR support for your tapes ?");
     1634        bkpinfo->use_obdr = ask_me_yes_or_no("Do you want to activate OBDR support for your tapes ?");
    16451635        bkpinfo->media_size[0] = 0;
    16461636        log_msg(4, "media_size[0] = %ld", bkpinfo->media_size[0]);
  • branches/2.2.10/mondo/src/common/libmondo-files-EXT.h

    r2325 r2334  
    1111extern bool does_file_exist(char *filename);
    1212extern void exclude_nonexistent_files(char *inout);
    13 extern int figure_out_kernel_path_interactively_if_necessary(char *kernel);
     13extern char *figure_out_kernel_path_interactively_if_necessary(void);
    1414extern char *find_home_of_exe(char *fname);
    1515extern int get_trackno_from_logfile(char *logfile);
  • branches/2.2.10/mondo/src/common/libmondo-files.c

    r2332 r2334  
    269269 * @return 0 for success, 1 for failure.
    270270 */
    271 int figure_out_kernel_path_interactively_if_necessary(char *kernel)
    272 {
     271char *figure_out_kernel_path_interactively_if_necessary(void) {
     272
    273273    char *tmp = NULL;
    274274    char *command = NULL;;
    275 
    276     if (kernel == NULL) {
    277         mr_asprintf(kernel, "%s", call_program_and_get_last_line_of_output("mindi --findkernel 2> /dev/null"));
    278     }
     275    char *kernel = NULL;;
     276
     277    mr_asprintf(kernel, "%s", call_program_and_get_last_line_of_output("mindi --findkernel 2> /dev/null"));
     278   
    279279    // If we didn't get anything back, check whether mindi raised a fatal error
    280280    if (!kernel[0]) {
     
    285285            mr_free(tmp);
    286286            mr_free(command);
     287            mr_free(kernel);
    287288            fatal_error("Mindi gave a fatal error. Please check '/var/log/mindi.log'.");
    288289        }
     
    293294    while (!kernel[0]) {
    294295        if (!ask_me_yes_or_no("Kernel not found or invalid. Choose another?")) {
    295             return (1);
     296            return (NULL);
    296297        }
    297298        tmp = popup_and_get_string("Kernel path", "What is the full path and filename of your kernel, please?", kernel);
     
    304305        log_it("User says kernel is at %s", kernel);
    305306    }
    306     return (0);
     307    return (kernel);
    307308}
    308309
     
    11031104    }
    11041105    *(p++) = '\0';
    1105     mr_asprintf(nfs_server_ipaddr, tmp);
    1106     mr_asprintf(nfs_mount, p);
     1106    mr_asprintf(nfs_server_ipaddr, "%s", tmp);
     1107    mr_asprintf(nfs_mount, "%s", p);
    11071108    mr_free(tmp);
    11081109
     
    11511152        mr_free(nfs_dev);
    11521153
    1153         mr_asprintf(nfs_dev, call_program_and_get_last_line_of_output(command));
     1154        mr_asprintf(nfs_dev, "%s", call_program_and_get_last_line_of_output(command));
    11541155        mr_free(command);
    11551156
  • branches/2.2.10/mondo/src/common/libmondo-files.h

    r2325 r2334  
    1414bool does_file_exist(char *filename);
    1515void exclude_nonexistent_files(char *inout);
    16 int figure_out_kernel_path_interactively_if_necessary(char *kernel);
     16char *figure_out_kernel_path_interactively_if_necessary(void);
    1717char *find_home_of_exe(char *fname);
    1818int get_trackno_from_logfile(char *logfile);
  • branches/2.2.10/mondo/src/common/libmondo-raid.c

    r2324 r2334  
    334334#ifdef __FreeBSD__
    335335    int i, j;
     336    char *org = NULL;
    336337
    337338    fprintf(fout, "\nvolume %s\n", raidrec->volname);
    338339    for (i = 0; i < raidrec->plexes; ++i) {
    339         char org[24];
    340340        switch (raidrec->plex[i].raidlevel) {
    341341        case -1:
    342             strcpy(org, "concat");
     342            mr_asprintf(org, "concat");
    343343            break;
    344344        case 0:
    345             strcpy(org, "striped");
     345            mr_asprintf(org, "striped");
    346346            break;
    347347        case 5:
    348             strcpy(org, "raid5");
     348            mr_asprintf(org, "raid5");
    349349            break;
    350350        }
    351351        fprintf(fout, "  plex org %s", org);
     352        mr_free(org);
     353
    352354        if (raidrec->plex[i].raidlevel != -1) {
    353355            fprintf(fout, " %ik", raidrec->plex[i].stripesize);
     
    356358
    357359        for (j = 0; j < raidrec->plex[i].subdisks; ++j) {
    358             fprintf(fout, "    sd drive %s size 0\n",
    359                     raidrec->plex[i].sd[j].which_device);
     360            fprintf(fout, "    sd drive %s size 0\n", raidrec->plex[i].sd[j].which_device);
    360361        }
    361362    }
     
    501502
    502503            if (get_option_state(argc, argv, "hotspare")) {
    503                 strcpy(raidlist->spares.el[raidlist->spares.entries].name,
    504                        drivename);
    505                 strcpy(raidlist->spares.el[raidlist->spares.entries].
    506                        device, devname);
     504                strcpy(raidlist->spares.el[raidlist->spares.entries].name, drivename);
     505                strcpy(raidlist->spares.el[raidlist->spares.entries].  device, devname);
    507506                raidlist->spares.el[raidlist->spares.entries].index =
    508507                    raidlist->disks.entries;
    509508                raidlist->spares.entries++;
    510509            } else {
    511                 strcpy(raidlist->disks.el[raidlist->disks.entries].name,
    512                        drivename);
    513                 strcpy(raidlist->disks.el[raidlist->disks.entries].device,
    514                        devname);
     510                strcpy(raidlist->disks.el[raidlist->disks.entries].name, drivename);
     511                strcpy(raidlist->disks.el[raidlist->disks.entries].device, devname);
    515512                raidlist->disks.el[raidlist->disks.entries].index =
    516513                    raidlist->disks.entries;
  • branches/2.2.10/mondo/src/common/libmondo-stream-EXT.h

    r2332 r2334  
    55extern int closein_tape();
    66extern int closeout_tape();
    7 extern char *find_tape_device_and_size(char *siz);
     7extern char *mr_find_tape_device(void);
    88extern void insist_on_this_tape_number(int tapeno);
    99extern void log_tape_pos(void);
  • branches/2.2.10/mondo/src/common/libmondo-stream.c

    r2332 r2334  
    253253    char *dev = NULL;
    254254    int res;
    255     char *dev = NULL;
    256255
    257256    log_to_screen("I am looking for your tape streamer. Please wait.");
     
    260259    if (tmp) {
    261260        mr_asprintf(cdr_exe, "cdrecord");
    262 
    263261    } else {
    264262        mr_asprintf(cdr_exe, "dvdrecord");
     
    273271        log_it("Either too few or too many tape streamers for me to detect...");
    274272        mr_asprintf(dev, "%s", VANILLA_SCSI_TAPE);
    275         mr_free(tmp);
    276273        mr_free(tmp);
    277274        return(dev);
     
    350347    } else {
    351348        log_it("At this new point, dev is NULL and res = %d", res);
    352         mr_free(tmp);
    353349    }
    354350
     
    531527    char *tmpdir = NULL;
    532528    char *old_fname = NULL;
    533     char *p;
    534     char suffix[16];
    535529
    536530    bufsize_K = (long long) (1024LL * (1 + g_tape_buffer_size_MB));
    537     if ((p = strrchr(latest_fname, '.'))) {
    538         strcpy(suffix, ++p);
    539     } else {
    540         suffix[0] = '\0';
    541     }
    542531    if (strstr(latest_fname, ".afio.") || strstr(latest_fname, ".star.")) {
    543532        type = fileset;
     
    11861175                  g_tape_stream) / 1024;
    11871176    }
    1188 /*  memcpy((char*)plength_of_incoming_file,(char*)tempblock+7001,sizeof(long long)); */
    1189 /*  for(*plen=0,i=7;i>=0;i--) {*plen<<=8; *plen |= tempblock[7001+i];} */
    11901177    memcpy((char *) plen, tempblock + 7001, sizeof(long long));
    11911178    if (strcmp(tempblock + 6000 + *pcontrol_char, STR_HEADER)) {
     
    11931180    }
    11941181    strcpy(filename, tempblock + 1000);
    1195 /*  strcpy(cksum,tempblock+5555);*/
    1196 /*  log_it( "%s  (reading) fname=%s, filesize=%ld K",
    1197        marker_to_string (*pcontrol_char), filename,
    1198        (long) ((*plen) >> 10));
    1199 */
    12001182    if (*pcontrol_char == BLK_ABORTED_BACKUP) {
    12011183        log_to_screen("I can't verify an aborted backup.");
  • branches/2.2.10/mondo/src/common/libmondo-stream.h

    r2332 r2334  
    77int closein_tape();
    88int closeout_tape();
    9 char *find_tape_device_and_size(char *siz);
     9char *mr_find_tape_device(void);
    1010void insist_on_this_tape_number(int tapeno);
    1111void log_tape_pos(void);
  • branches/2.2.10/mondo/src/common/libmondo-string.c

    r2323 r2334  
    4545    assert(partno >= 0);
    4646
    47     mr_asprintf(partition, drive);
     47    mr_asprintf(partition, "%s", drive);
    4848    /* is this a devfs device path? */
    4949    c = strrchr(partition, '/');
  • branches/2.2.10/mondo/src/common/libmondo-tools.c

    r2332 r2334  
    170170void clean_up_KDE_desktop_if_necessary(void)
    171171{
    172     char *tmp;
    173 
    174     malloc_string(tmp);
    175     strcpy(tmp,
    176            "for i in `find /root /home -type d -name Desktop -maxdepth 2`; do \
    177 file=$i/.directory; if [ -f \"$file\" ] ; then mv -f $file $file.old ; \
    178 awk '{if (index($0, \"rootimagesmindi\")) { while (length($0)>2) { getline;} ; } \
    179 else { print $0;};}' $file.old  > $file ; fi ; done");
     172    char *tmp = NULL;
     173
     174    mr_asprintf(tmp, "for i in `find /root /home -type d -name Desktop -maxdepth 2`; do file=$i/.directory; if [ -f \"$file\" ] ; then mv -f $file $file.old ; awk '{if (index($0, \"rootimagesmindi\")) { while (length($0)>2) { getline;} ; } else { print $0;};}' $file.old  > $file ; fi ; done");
    180175    run_program_and_log_output(tmp, 5);
    181     paranoid_free(tmp);
     176    mr_free(tmp);
    182177}
    183178
     
    227222double get_kernel_version(void)
    228223{
    229     char *p, tmp[200];
     224    char *p = NULL;
     225    char *tmp = NULL;
    230226    double d;
    231227#ifdef __FreeBSD__
     
    233229    d = 5.2;                    // :-)
    234230#else
    235     strcpy(tmp, call_program_and_get_last_line_of_output("uname -r"));
     231    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("uname -r"));
    236232    p = strchr(tmp, '.');
    237233    if (p) {
     
    244240        }
    245241    }
    246 //  log_msg(1, "tmp = '%s'", tmp);
    247242    d = atof(tmp);
     243    mr_free(tmp);
    248244#endif
    249245    log_msg(1, "g_kernel_version = %f", d);
     
    252248
    253249
    254 
    255 
    256 
    257250/**
    258251 * Get the current time.
     
    263256    return (long) time((void *) 0);
    264257}
    265 
    266 
    267 
    268 
    269 
    270258
    271259
     
    411399    char *command = NULL;
    412400    char *mtpt;
    413     char *hostname;
     401    char *hostname = NULL;
    414402    char *ip_address = NULL;
    415403    int retval = 0;
    416404    char *colon;
    417     char *cdr_exe;
     405    char *cdr_exe = NULL;
    418406    char *tmp = NULL;
    419407    char *p = NULL;
     
    431419
    432420    malloc_string(mtpt);
    433     malloc_string(hostname);
    434     malloc_string(cdr_exe);
    435421    bkpinfo->optimal_set_size =
    436422        (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type) ? 16 : 16) *
     
    496482        tmp = find_home_of_exe("growisofs");
    497483        if (tmp) {
    498             strcpy(cdr_exe, "growisofs");
     484            mr_asprintf(cdr_exe, "growisofs");
    499485        }                       // unlikely to be used
    500486        else {
     
    560546        tmp = find_home_of_exe("cdrecord");
    561547        if (tmp) {
    562             strcpy(cdr_exe, "cdrecord");
     548            mr_asprintf(cdr_exe, "cdrecord");
    563549        } else {
    564550            mr_free(tmp);
    565551            tmp = find_home_of_exe("dvdrecord");
    566552            if (tmp) {
    567                 strcpy(cdr_exe, "dvdrecord");
     553                mr_asprintf(cdr_exe, "dvdrecord");
    568554            } else {
    569555                mr_free(tmp);
     
    590576    }
    591577#endif
    592         else
    593         {
     578        else {
    594579            mr_asprintf(mondo_mkisofs_sz, MONDO_MKISOFS_REGULAR_SYSLINUX);
    595580        }
     
    613598            mr_asprintf(bkpinfo->call_make_iso, "%s . 2>> _ERR_ | %s %s %s fs=4m dev=%s speed=%d -", mondo_mkisofs_sz, cdr_exe, (bkpinfo->please_dont_eject) ? " " : "-eject", extra_cdrom_params, bkpinfo->media_device, bkpinfo->cdrw_speed);
    614599        }
     600        mr_free(cdr_exe);
    615601        paranoid_free(mondo_mkisofs_sz);
    616602        paranoid_free(extra_cdrom_params);
     
    654640            mr_asprintf(iso_path, "%s", iso_tmp + strlen(iso_mnt));
    655641        }
     642        mr_free(iso_mnt);
    656643        mr_free(iso_tmp);
    657644
     
    674661    if (bkpinfo->backup_media_type == nfs) {
    675662        if (bkpinfo->nfs_mount) {
    676             strcpy(hostname, bkpinfo->nfs_mount);
     663            mr_asprintf(hostname, "%s", bkpinfo->nfs_mount);
    677664        } else {
    678665            log_it("nfs_mount is NULL");
    679666            retval++;
    680             strcpy(hostname, "");
     667            mr_asprintf(hostname, "");
    681668        }
    682669        colon = strchr(hostname, ':');
     
    699686            }
    700687        }
     688        mr_free(hostname);
    701689        store_nfs_config();
    702690    }
     
    712700    g_backup_media_type = bkpinfo->backup_media_type;
    713701    paranoid_free(mtpt);
    714     paranoid_free(hostname);
    715     paranoid_free(cdr_exe);
    716702    return (retval);
    717703}
     
    12541240    mr_asprintf(command, "mount | grep -Ew '/boot'");
    12551241    mr_free(tmp);
    1256     mr_asprintf(tmp, call_program_and_get_last_line_of_output(command));
     1242    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    12571243    mr_free(command);
    12581244
  • branches/2.2.10/mondo/src/common/libmondo-verify.c

    r2327 r2334  
    623623    /*@ char ************************************************************ */
    624624    char *test_file = NULL;
    625     char *biggie_cksum;
    626     char *orig_cksum;
     625    char *biggie_cksum = NULL;
     626    char *orig_cksum = NULL;
    627627    char *tmp = NULL;
    628628    char *slice_fnam;
     
    634634    long long slice_siz;
    635635
    636     malloc_string(biggie_cksum);
    637     malloc_string(orig_cksum);
    638636    malloc_string(slice_fnam);
    639637    assert(bkpinfo != NULL);
     
    651649         ctrl_chr != BLK_STOP_A_BIGGIE;
    652650         res =
    653          read_header_block_from_stream(&slice_siz, slice_fnam,
    654                                        &ctrl_chr)) {
     651         read_header_block_from_stream(&slice_siz, slice_fnam, &ctrl_chr)) {
    655652        if (ctrl_chr != BLK_START_AN_AFIO_OR_SLICE) {
    656653            wrong_marker(BLK_START_AN_AFIO_OR_SLICE, ctrl_chr);
     
    659656        unlink(test_file);
    660657        res =
    661             read_header_block_from_stream(&slice_siz, slice_fnam,
    662                                           &ctrl_chr);
     658            read_header_block_from_stream(&slice_siz, slice_fnam, &ctrl_chr);
    663659        if (ctrl_chr != BLK_STOP_AN_AFIO_OR_SLICE) {
    664660            log_msg(2, "test_file = %s", test_file);
     
    668664        retval += res;
    669665    }
    670     strcpy(biggie_cksum, slice_fnam);
     666    mr_asprintf(biggie_cksum, "%s", slice_fnam);
    671667    if (biggie_cksum[0] != '\0') {
    672         strcpy(orig_cksum, calc_checksum_of_file(biggie_fname));
     668        mr_asprintf(orig_cksum, "%s", calc_checksum_of_file(biggie_fname));
    673669        if (strcmp(biggie_cksum, orig_cksum)) {
    674670            log_msg(2, "orig cksum=%s; curr cksum=%s", biggie_cksum, orig_cksum);
     
    680676        }
    681677    }
     678    mr_free(biggie_cksum);
    682679    mr_free(test_file);
    683     paranoid_free(biggie_cksum);
    684     paranoid_free(orig_cksum);
     680    mr_free(orig_cksum);
    685681    paranoid_free(slice_fnam);
    686682    return (retval);
  • branches/2.2.10/mondo/src/common/newt-specific.c

    r2331 r2334  
    345345            log_msg(0, "-------FATAL ERROR---------");
    346346            log_msg(0, error_string);
    347             newtFinished();
    348347        }
    349348
     
    395394        }
    396395        if (!g_text_mode) {
    397             if (does_file_exist("/THIS-IS-A-RAMDISK")) {
    398                 log_msg(1, "Calling newtFinished()");
    399                 newtFinished();
    400             } else {
    401                 log_msg(1, "Calling newtSuspend()");
    402                 newtSuspend();
    403             }
     396            log_msg(1, "Calling newtFinished()");
     397            newtFinished();
    404398        }
    405399        printf("Execution run ended; result=%d\n", signal);
     
    444438
    445439        /*@ buffers ********************************************************** */
    446         char *command;
    447         char *tmp;
     440        char *command = NULL;
     441        char *tmp = NULL;
    448442
    449443        /*@ pointers ********************************************************* */
     
    453447        int i = 0;
    454448
    455         malloc_string(command);
    456         malloc_string(tmp);
    457449        assert_string_is_neither_NULL_nor_zerolength(filename);
    458450        assert(grep_for_me != NULL);
    459451
    460452        if (!does_file_exist(filename)) {
    461             paranoid_free(command);
    462             paranoid_free(tmp);
    463453            return;
    464454        }
    465455        if (grep_for_me[0] != '\0') {
    466             sprintf(command, "grep '%s' %s | tail -n%d",
    467                     grep_for_me, filename, g_noof_log_lines);
    468         } else {
    469             sprintf(command, "tail -n%d %s", g_noof_log_lines,
    470                     filename);
     456            mr_asprintf(command, "grep '%s' %s | tail -n%d", grep_for_me, filename, g_noof_log_lines);
     457        } else {
     458            mr_asprintf(command, "tail -n%d %s", g_noof_log_lines, filename);
    471459        }
    472460        fin = popen(command, "r");
     
    483471                    */
    484472                    if (!strncmp(err_log_lines[i], "root:", 5)) {
    485                         strcpy(tmp, err_log_lines[i] + 6);
     473                        mr_asprintf(tmp, "%s", err_log_lines[i] + 6);
    486474                        strcpy(err_log_lines[i], tmp);
     475                        mr_free(tmp);
    487476                    }
    488477                    if (feof(fin)) {
     
    493482            paranoid_pclose(fin);
    494483        }
     484        mr_free(command);
    495485        refresh_log_screen();
    496         paranoid_free(command);
    497         paranoid_free(tmp);
    498486    }
    499487
     
    584572
    585573        /*@ buffers ********************************************************* */
    586         char *title;
    587         char *tmp;
     574        char *title = NULL;
     575        char *tmp = NULL;
    588576
    589577        /*@ initialize ****************************************************** */
    590578        g_isoform_old_progress = -1;
    591579        g_mysterious_dot_counter = 0;
    592         malloc_string(title);
     580
     581        assert(ttl != NULL);
    593582        malloc_string(tmp);
    594 
    595         assert(ttl != NULL);
    596         strcpy(title, ttl);
     583        mr_asprintf(title, "%s", ttl);
    597584        strcpy(g_isoform_header_str, title);
    598585        if (g_text_mode) {
     
    620607        }
    621608        update_evalcall_form(0);
     609        mr_free(title);
    622610        paranoid_free(tmp);
    623         paranoid_free(title);
    624611    }
    625612
     
    641628        /*@ buffers ********************************************************* */
    642629        char *b1c;
    643         char *blurb1;
    644         char *blurb2;
    645         char *blurb3;
     630        char *blurb1 = NULL;
     631        char *blurb2 = NULL;
     632        char *blurb3 = NULL;
    646633
    647634        /*@ initialize ****************************************************** */
    648635        g_mysterious_dot_counter = 0;
    649636
    650         malloc_string(b1c);
    651637        malloc_string(blurb1);
    652638        malloc_string(blurb2);
    653639        malloc_string(blurb3);
     640        malloc_string(b1c);
    654641
    655642        assert(title != NULL);
     
    658645        assert(b3 != NULL);
    659646
    660         strcpy(blurb1, b1);
    661         strcpy(blurb2, b2);
    662         strcpy(blurb3, b3);
     647        strcpy(blurb1,  b1);
     648        strcpy(blurb2,  b2);
     649        strcpy(blurb3,  b3);
    663650        strcpy(b1c, b1);
    664651        center_string(b1c, 80);
     
    695682        update_progress_form_full(blurb1, blurb2, blurb3);
    696683        paranoid_free(b1c);
    697         paranoid_free(blurb1);
    698         paranoid_free(blurb2);
    699         paranoid_free(blurb3);
     684        mr_free(blurb1);
     685        mr_free(blurb2);
     686        mr_free(blurb3);
    700687    }
    701688
     
    11761163
    11771164        /*@ newt ************************************************************ */
    1178         char *title_sz;
    1179         char *minimsg_sz;
     1165        char *title_sz = NULL;
     1166        char *minimsg_sz = NULL;
    11801167        static t_bkptype possible_bkptypes[] =
    11811168            { none, cdr, cdrw, dvd, tape, cdstream, udev, nfs, iso };
     
    11981185        newtComponent myForm;
    11991186
    1200         title_sz = malloc(MAX_NEWT_COMMENT_LEN);
    1201         minimsg_sz = malloc(MAX_NEWT_COMMENT_LEN);
    12021187        outstr = malloc(MAX_NEWT_COMMENT_LEN);
    12031188        if (g_text_mode) {
     
    12171202                }
    12181203            }
    1219             paranoid_free(title_sz);
    1220             paranoid_free(minimsg_sz);
    12211204            paranoid_free(outstr);
    12221205            return (backup_type);
     
    12241207        newtDrawRootText(18, 0, WELCOME_STRING);
    12251208        if (restoring) {
    1226             strcpy(title_sz,
    1227                    "Please choose the backup media from which you want to read data.");
    1228             strcpy(minimsg_sz, "Read from:");
    1229         } else {
    1230             strcpy(title_sz,
    1231                    "Please choose the backup media to which you want to archive data.");
    1232             strcpy(minimsg_sz, "Backup to:");
     1209            mr_asprintf(title_sz, "Please choose the backup media from which you want to read data.");
     1210            mr_asprintf(minimsg_sz, "Read from:");
     1211        } else {
     1212            mr_asprintf(title_sz, "Please choose the backup media to which you want to archive data.");
     1213            mr_asprintf(minimsg_sz, "Backup to:");
    12331214        }
    12341215        newtPushHelpLine(title_sz);
     
    12661247        }
    12671248        newtPopHelpLine();
    1268         paranoid_free(title_sz);
    1269         paranoid_free(minimsg_sz);
     1249        mr_free(title_sz);
     1250        mr_free(minimsg_sz);
    12701251        paranoid_free(outstr);
    12711252        return (output);
Note: See TracChangeset for help on using the changeset viewer.