--- src/scheduler.cc/samples/fifo/job_info.c.orig 2009-10-29 21:01:21.000000000 +0000 +++ src/scheduler.cc/samples/fifo/job_info.c 2010-11-11 09:52:32.898143296 +0000 @@ -681,6 +681,8 @@ NULL, ATTR_comment, NULL, NULL, 0 }; + static char *clone; + if (jinfo == NULL) return 1; @@ -692,10 +694,18 @@ jinfo -> comment = string_dup(comment); - attr.value = comment; + /* Assign new, copied version of "comment" to a pointer we can guarantee + pbs_alterjob() can't mangle anything important and so that we can + free() it safely after the call. */ + + clone = string_dup(comment); + + attr.value = clone; pbs_alterjob(pbs_sd, jinfo -> name, &attr, NULL); + free(clone); + return 0; }