[torqueusers] Possible oversite in torque_gssapi

Ken Nielson knielson at adaptivecomputing.com
Wed Nov 25 09:58:02 MST 2009


Mike Coyne wrote:
>
> In building the gassapi version ot torque from the svn archive I ran 
> across a memory leak in pbs_mom after running valgrind
>
> It would appear the buffers allocated int the DIS_tcp_setup() didn’t 
> get seem to be free’d when the
>
> DIS_tcp_release() was called so I proposed adding the following…
>
> This may have resulted from a bad job incorporating the latest update 
> in svn to my local build but I though I would ask the group if this is 
> the right place to free the buffers?
>
> Index: /trunk/torque_gss/src/lib/Libifl/tcp_dis.c
>
> ===================================================================
>
> --- /trunk/torque_gss/src/lib/Libifl/tcp_dis.c (revision 534)
>
> +++ /trunk/torque_gss/src/lib/Libifl/tcp_dis.c (revision 538)
>
> @@ -1075,16 +1075,28 @@
>
> #ifdef GSSAPI
>
> OM_uint32 minor;
>
> #endif
>
> + struct tcp_chan *tcp;
>
> + struct tcpdisbuf *tp;
>
> +
>
> assert (fd >= 0);
>
> if (fd >= tcparraymax || tcparray[fd] == NULL)
>
> return; /* Might be an RPP connection */
>
> +
>
> + tcp=tcparray[fd];
>
> + tp = &tcp->readbuf;
>
> + if (tp->tdis_thebuf != NULL) free(tp->tdis_thebuf);
>
> + tp = &tcp->writebuf;
>
> + if (tp->tdis_thebuf != NULL) free(tp->tdis_thebuf);
>
> #ifdef GSSAPI
>
> if (tcparray[fd]->gssctx != GSS_C_NO_CONTEXT)
>
> gss_delete_sec_context (&minor, &tcparray[fd]->gssctx, GSS_C_NO_BUFFER);
>
> if (tcparray[fd]->unwrapped.value)
>
> gss_release_buffer (&minor, &tcparray[fd]->unwrapped);
>
> + /*fix memory loss in DIS_scp_setup */
>
> + tp = &tcp->gssrdbuf;
>
> + if (tp->tdis_thebuf != NULL) free(tp->tdis_thebuf);
>
> #endif
>
> free(tcparray[fd]);
>
> tcparray[fd] = NULL;
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> torqueusers mailing list
> torqueusers at supercluster.org
> http://www.supercluster.org/mailman/listinfo/torqueusers
>   
Mike,

Never mind about my last e-mail. You did free the buffer for 
tcparray[fd]. So no seg-fault.

Ken


More information about the torqueusers mailing list