Changeset 1015


Ignore:
Timestamp:
Dec 31, 2006, 2:38:51 AM (13 years ago)
Author:
bruno
Message:

Fix a memory allocation bug in gen_aux_list (Klaus Ade Johnstad)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mondo/src/common/libmondo-filelist.c

    r944 r1015  
    562562    char *syscall;
    563563    char *file_to_analyze;
     564    char *strtmp = NULL;
    564565    int i;
    565566
     
    576577        return (4);
    577578    }
    578     malloc_string(syscall);
    579579    malloc_string(file_to_analyze);
    580580    for (fgets(file_to_analyze, MAX_STR_LEN, fin); !feof(fin);
     
    585585        }
    586586        log_msg(8, "Analyzing %s", file_to_analyze);
    587         sprintf(syscall, syscall_sprintf, mr_stresc(file_to_analyze, "`$\\\"", '\\'));
    588         strcat(syscall, " 2>> /dev/null");  // " MONDO_LOGFILE);
     587        asprintf(&strtmp, syscall_sprintf, mr_stresc(file_to_analyze, "`$\\\"", '\\'));
     588        asprintf(&syscall, "%s 2>> /dev/null", strtmp); // " MONDO_LOGFILE);
     589        paranoid_free(strtmp);
    589590        call_exe_and_pipe_output_to_fd(syscall, pout);
     591        paranoid_free(syscall);
    590592    }
    591593    paranoid_fclose(fin);
    592594    paranoid_pclose(pout);
    593595    paranoid_free(file_to_analyze);
    594     paranoid_free(syscall);
    595596    paranoid_free(pout_command);
    596597    return (0);
Note: See TracChangeset for help on using the changeset viewer.