# HG changeset patch # User Binki # Date 2009-10-10 13:00:18 # Node ID f7a90d38ac0f6bbf129ac98e40798d93a4fba74b # Parent dab7d18a7366f75990d0e76f8ea8972a7624ad74 prepare_distrenjob(): malloc() frameset, handle errors diff --git a/src/server/distrend.c b/src/server/distrend.c --- a/src/server/distrend.c +++ b/src/server/distrend.c @@ -239,13 +239,16 @@ int restoreJobState(struct distrenjob *j } /** creates a structure from starting data, then calls another function to actually add that struct to the queue */ -void prepare_distrenjob(struct distrenjob *head, int type, char *name, char *submitter, char *email, int priority, int start_frame, int end_frame, int width, int height) +int prepare_distrenjob(struct distrenjob *head, int type, char *name, char *submitter, char *email, int priority, int start_frame, int end_frame, int width, int height) { int counter2; int counter; + int tmp; struct distrenjob *distrenjob; - distrenjob_new(&distrenjob); + tmp = distrenjob_new(&distrenjob); + if(tmp) + return 1; distrenjob->type = 1; distrenjob->name = name; @@ -254,7 +257,13 @@ void prepare_distrenjob(struct distrenjo distrenjob->priority = priority; distrenjob->width = width; distrenjob->height = height; - distrenjob->total_frames = (end_frame - start_frame + 1); // sets the total number of frames in animation for status purposes + distrenjob->total_frames = (end_frame - start_frame + 1); /* sets the total number of frames in animation for status purposes */ + distrenjob->frameset = malloc(sizeof(struct frameset) * distrenjob->total_frames); + if(!distrenjob->frameset) + { + distrenjob_free(&distrenjob); + return 1; + } /* prepares all the frames by setting that status to "unassigned" */ counter2 = start_frame; @@ -272,6 +281,8 @@ void prepare_distrenjob(struct distrenjo general_info.jobs_in_queue++; updateJobListXML(head); updateGeneralInfo(); + + return 0; }