~tritone-team/tritone/eucalyptus

« back to all changes in this revision

Viewing changes to node/handlers_kvm.c

  • Committer: Bazaar Package Importer
  • Author(s): Dustin Kirkland
  • Date: 2009-12-01 21:09:28 UTC
  • mto: This revision was merged to the branch mainline in revision 75.
  • Revision ID: james.westby@ubuntu.com-20091201210928-o2dvg0ubljhb0ft6
Tags: upstream-1.6.1~bzr1083
ImportĀ upstreamĀ versionĀ 1.6.1~bzr1083

Show diffs side-by-side

added added

removed removed

Lines of Context:
100
100
#define GET_VALUE(name,var) \
101
101
        if (get_value (s, name, &var)) { \
102
102
                logprintfl (EUCAFATAL, "error: did not find %s in output from %s\n", name, nc->get_info_cmd_path); \
103
 
                free (s); \
 
103
                if (s) free (s); \
104
104
                return ERROR_FATAL; \
105
105
        }
106
106
 
107
107
        GET_VALUE("nr_cores", nc->cores_max);
108
108
        GET_VALUE("total_memory", nc->mem_max);
 
109
        if (s) free(s);
 
110
 
109
111
        /* we leave 256M to the host  */
110
112
        nc->mem_max -= 256;
111
113
 
186
188
 
187
189
    /* do the potentially long tasks in a thread */
188
190
    pthread_attr_t* attr = (pthread_attr_t*) malloc(sizeof(pthread_attr_t));
 
191
    if (!attr) {
 
192
        free_instance (&instance);
 
193
        logprintfl (EUCAFATAL, "Error: out of memory\n");
 
194
        return 1;
 
195
    }
189
196
    pthread_attr_init(attr);
190
197
    pthread_attr_setdetachstate(attr, PTHREAD_CREATE_DETACHED);
191
198
 
196
203
        remove_instance (&global_instances, instance);
197
204
        sem_v (inst_sem);
198
205
        free_instance (&instance);
 
206
        free(attr);
199
207
        return 1;
200
208
    }
201
209
    pthread_attr_destroy(attr);
 
210
    if (attr) free(attr);
202
211
 
203
212
    * outInst = instance;
204
213
    return 0;