Changeset - f7a90d38ac0f
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 16 years ago 2009-10-10 13:00:18
ohnobinki@ohnopublishing.net
prepare_distrenjob(): malloc() frameset, handle errors
1 file changed with 14 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/server/distrend.c
Show inline comments
 
@@ -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;
 
}
 

	
 

	
0 comments (0 inline, 0 general)