1 Reply Latest reply: Aug 21, 2012 2:14 AM by jim dc RSS

    OCIAttrGet - Should we free the memory allocated to the out variable

    user12559680
      In the below code, the application is crashing @ free(svcname).
      What is the issue here? should we delete the out variable or not?

      {
      char* svcname;

      if (OCIAttrGet(eventhp, (ub4) OCI_HTYPE_EVENT, (dvoid *) &svcname, (ub4 *) &sizep, OCI_ATTR_SERVICENAME, dm_infop->errhp) != OCI_SUCCESS) {
      pinlog(PIN_FILE_SOURCE_ID, __LINE__, LOG_FLAG_ERROR, " Unable to get service name.\n");
      return;
      }

      free(svcname);
      }

      -Shiva