Changeset 689 in MondoRescue for trunk/mondo/mondo/common/libmondo-devices.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-devices.c

    r688 r689  
    495495char *find_cdrw_device(void)
    496496{
    497     /*@ buffers ************************ */
    498     char *comment;
    499     char *tmp;
    500     char *cdr_exe;
    501     char *command;
    502     char *cdrw_device;
     497    char *comment = NULL;
     498    char *tmp = NULL;
     499    char *tmp1 = NULL;
     500    char *cdr_exe = NULL;
     501    char *command = NULL;
     502    char *cdrw_device = NULL;
    503503
    504504    if (g_cdrw_drive_is_here != NULL) {
     
    513513    }
    514514    run_program_and_log_output("insmod ide-scsi", -1);
    515     if (find_home_of_exe("cdrecord")) {
     515    tmp = find_home_of_exe("cdrecord");
     516    if (tmp) {
    516517        asprintf(&cdr_exe, "cdrecord");
    517518    } else {
    518519        asprintf(&cdr_exe, "dvdrecord");
    519520    }
    520     if (find_home_of_exe(cdr_exe)) {
     521    paranoid_free(tmp);
     522
     523    tmp1 = find_home_of_exe(cdr_exe);
     524    if (tmp1) {
    521525        asprintf(&command,
    522526                "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep CD | cut -d' ' -f2 | head -n1",
     
    527531        asprintf(&tmp, " ");
    528532    }
     533    paranoid_free(tmp1);
    529534    paranoid_free(cdr_exe);
    530535
     
    594599    }
    595600
    596     if (find_home_of_exe("cdrecord")) {
     601    tmp = find_home_of_exe("cdrecord");
     602    if (tmp) {
    597603        asprintf(&cdr_exe, "cdrecord");
    598604    } else {
    599605        asprintf(&cdr_exe, "dvdrecord");
    600606    }
    601     if (!find_home_of_exe(cdr_exe)) {
     607    paranoid_free(tmp);
     608
     609    tmp = find_home_of_exe(cdr_exe);
     610    if (!tmp) {
    602611        asprintf(&output, "/dev/cdrom");
    603612        log_msg(4, "Can't find cdrecord; assuming %s", output);
     
    612621        }
    613622    }
     623    paranoid_free(tmp);
    614624
    615625    asprintf(&command, "%s -scanbus 2> /dev/null", cdr_exe);
Note: See TracChangeset for help on using the changeset viewer.