Title: Is this a memory leak in

Would you please straight me out on following  question?  I was challenged by my friends here. And I can not provide a good answer to them. Thanks a bunch.

IN the code "Create.c >> xbaeCopyCells(XbaeMatrixWidget mw)", it was noticed that the  two dimension arrary "copy" is allocated , then assign the address to other variable. But the "copy" is not freed in this code.

Is it freed at somewhere else ??

See sample code below.



xbaeCopyCells(XbaeMatrixWidget mw)
{
    String **copy = NULL;
    int i, j;
    Boolean empty_row;

    xbaeObjectLock((Widget)mw);

    if (mw->matrix.rows && mw->matrix.columns)
    {
  /*
   * Malloc an array of row pointers
   */
  copy = (String **) XtMalloc(mw->matrix.rows * sizeof(String *));  <<<<<??? Allocate memory ????

    ......
    ......< skip other code >
    ......
 
 mw->matrix.cells = copy;                            <<<<<<<  assign memory location to someone else ????               

                                                                                  But who free it ?

    xbaeObjectUnlock((Widget)mw);
}




Reply via email to