/******************************************************************
* Create flist of the form:
* 0 PIN_FLD_POID POID [0] 0.0.0.1 -1 0
* 0 PIN_FLD_LAST_NAME STR [0] "Mouse"
* 0 PIN_FLD_FIRST_NAME STR [0] "Mickey"
******************************************************************/
pin_flist_t* create_flist() {
pin_flist_t* flistp = NULL;
int64 db = 1;
int64 id = -1;
const char *first = NULL;
const char *last = NULL;
pin_errbuf_t ebuf;
poid_t *a_pdp = NULL;
printf("\nCreate a simple flist:\n\n");
/* Clear the error buffer (for safety) */
PIN_ERR_CLEAR_ERR(&ebuf);
/* Allocate flist */
flistp = PIN_FLIST_CREATE(&ebuf);
/*******************************************************************
* PUT and SET
*
* Use PIN_FLIST_FLD_SET to add a copy of the field to an flist. The
* value passed in does not have to be in dynamic memory and it is
* unaffected by the macro.
*
* Use PIN_FLIST_FLD_PUT to add the field, including its data value
* to an flist. The memory holding the value must be dynamically
* allocated; useful to add a field to the flist without copying
* its value. Once the value of the field has been added to the
* flist, the memory can no longer be accessed and the original
* pointer is not valid.
*
* Please see the flist documentation for more information.
*******************************************************************/
/* Create and add a type-only poid. */
a_pdp = PIN_POID_CREATE(db, "/account", id, &ebuf);
PIN_FLIST_FLD_PUT(flistp, PIN_FLD_POID, a_pdp, &ebuf);
/* Create and add two strings */
first = "Mickey";
last = "Mouse";
PIN_FLIST_FLD_SET(flistp, PIN_FLD_FIRST_NAME, (void *)first, &ebuf);
PIN_FLIST_FLD_SET(flistp, PIN_FLD_LAST_NAME, (void *)last, &ebuf);
PIN_FLIST_PRINT(flistp, NULL, &ebuf);
printf("\n---------------------------------------------------------\n");
return flistp;
}
this a_pdp is set inside flist, and it will be destroyed when we call
-> /* Free the flist */
PIN_FLIST_DESTROY_EX(&flistp, NULL);
Fortify is not able to track the deallocation correctly
Please suggest if there is any solution for this