trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DaveBirdsall <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request: [TRAFODION-1100] Creator of view...
Date Thu, 19 Nov 2015 17:32:09 GMT
Github user DaveBirdsall commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/182#discussion_r45372631
  
    --- Diff: core/sql/sqlcomp/CmpSeabaseDDLview.cpp ---
    @@ -1498,32 +1577,50 @@ PrivColumnBitmap colGrantableBitmap;
           }
           int32_t usedColNumber = naCol->getPosition();
          
    -      // Grab privileges from the NATable structure
    -      PrivMgrUserPrivs *privs = naTable->getPrivInfo();
    -      if (privs == NULL) 
    +      PrivMgrUserPrivs privs;
    +      PrivMgrUserPrivs *pPrivInfo = NULL;
    +      if (viewCreator)
    +        pPrivInfo = naTable->getPrivInfo();
    +      else
    +      {
    +        PrivStatus retcode = privInterface.getPrivileges((int64_t)naTable->objectUid().get_value(),
    +                                                           naTable->getObjectType(),
    +                                                           naTable->getOwner(),
    +                                                           privs);
    +
    +        if (retcode == STATUS_ERROR)
    +        {
    +           *CmpCommon::diags() << DgSqlCode(-CAT_UNABLE_TO_RETRIEVE_PRIVS);
    +           return false;
    +        }
    +        pPrivInfo = &privs;
    --- End diff --
    
    So, in one code path pPrivInfo points to a heap-allocated structure while in this code
path it points to a stack variable. Is there any issue with memory leaks in the first case?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message