Changeset 689 in MondoRescue for trunk/mondo/mondo/common/libmondo-fork.c


Ignore:
Timestamp:
Jul 17, 2006, 7:43:58 PM (18 years ago)
Author:
bcornec
Message:

Still other memory management improvements ( I hope :-)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mondo/mondo/common/libmondo-fork.c

    r688 r689  
    510510// BACKUP
    511511    int res = -1;
    512     char*command;
     512    char *command = NULL;
     513    char *tmp = NULL;
    513514
    514515    if (!does_file_exist(input_device)) {
    515516        fatal_error("input device does not exist");
    516517    }
    517     if ( !find_home_of_exe("ntfsclone")) {
     518    tmp = find_home_of_exe("ntfsclone");
     519    if (!tmp) {
    518520        fatal_error("ntfsclone not found");
    519521    }
    520     malloc_string(command);
    521     sprintf(command, "ntfsclone --force --save-image --overwrite %s %s", output_fname, input_device);
     522    paranoid_free(tmp);
     523
     524    asprintf(&command, "ntfsclone --force --save-image --overwrite %s %s", output_fname, input_device);
    522525    res = run_program_and_log_output(command, 5);
    523526    paranoid_free(command);
     527
    524528    unlink(output_fname);
    525529    return (res);
     
    678682// RESTORE
    679683    int res = -1;
    680     char *command;
    681 
    682     if ( !find_home_of_exe("ntfsclone")) {
     684    char *command = NULL;
     685    char *tmp = NULL;
     686
     687    tmp = find_home_of_exe("ntfsclone");
     688    if (!tmp) {
    683689        fatal_error("ntfsclone not found");
    684690    }
     691    paranoid_free(tmp);
     692
    685693    asprintf(&command, "ntfsclone --force --restore-image --overwrite %s %s", output_device, input_fifo);
    686694    res = run_program_and_log_output(command, 5);
Note: See TracChangeset for help on using the changeset viewer.