<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<pre>Hi,
Should the pbsndlist and pbsndmast arrays (of ptr) have the same size?
I see in one place where there is a realloc of pbsndmast to svr_totnodes
+ 1. After this svr_totnodes++ is done. And a realloc of pbsndlist to
svr_totnodes + 1 (with already increased svr_totnodes variable). Is this
how it is supposed to be? All of these inside the "create_pbs_node"
function in the src/server/node_func.c file.
Here is the code snippet: (Note the underlined expressions)
.
tmpndlist = (struct pbsnode **)realloc(
pbsndmast,
sizeof(struct pbsnode*) * (<u>svr_totnodes + 1</u>));
if (tmpndlist == (struct pbsnode **)0)
{
free(pnode);
free(pul);
free(pname);
return(PBSE_SYSTEM);
}
/*add in the new entry etc*/
pbsndmast = tmpndlist;
pbsndmast[<u>svr_totnodes++</u>] = pnode;
tmpndlist = (struct pbsnode **)realloc(
pbsndlist,
sizeof(struct pbsnode *) * (<u>svr_totnodes + 1</u>));
.
Thanks,
Prakash</pre>
</body>
</html>