Hello!

This code has memory leaks, either if theWorkspace is NULL or if the fopen fails.

#ifdef G_OS_WIN32
    char *temp_file = g_strdup_printf("%s\\_%d_%ld_1.cpp", config_dir, getpid(), time(NULL));
    char *temp_file2 = g_strdup_printf("%s\\_%d_%ld_2.cpp", config_dir, getpid(), time(NULL));
#else
    char *temp_file = g_strdup_printf("%s/%d_%ld_1.cpp", config_dir, getpid(), time(NULL));
    char *temp_file2 = g_strdup_printf("%s/%d_%ld_2.cpp", config_dir, getpid(), time(NULL));
#endif

    if (NULL == theWorkspace || NULL == (fp = g_fopen(temp_file, "w")))
        return FALSE;

I changed it to:

#ifdef G_OS_WIN32
    char *temp_file = g_strdup_printf("%s\\_%d_%ld_1.cpp", config_dir, getpid(), time(NULL));
    char *temp_file2 = g_strdup_printf("%s\\_%d_%ld_2.cpp", config_dir, getpid(), time(NULL));
#else
    char *temp_file = g_strdup_printf("%s/%d_%ld_1.cpp", config_dir, getpid(), time(NULL));
    char *temp_file2 = g_strdup_printf("%s/%d_%ld_2.cpp", config_dir, getpid(), time(NULL));
#endif

    if (NULL == theWorkspace || NULL == (fp = g_fopen(temp_file, "w")))
    {
        g_free(temp_file);
        g_free(temp_file2);
        return FALSE;
    }

Best regards,
Daniel


_______________________________________________________________
Parfym och kosmetik upp till 50% billigare hos BeautyPlanet.se - Klicka h�r!