Closed sanchit-saini closed 4 years ago
Not sure what's going wrong. It's possible that the number of fields in that row is smaller than the number globally declared. The bigBedIntervalToRow()
function returns the actual number of fields. Perhaps that is smaller than fieldCount
.
Not sure what's going wrong. It's possible that the number of fields in that row is smaller than the number globally declared. The
bigBedIntervalToRow()
function returns the actual number of fields. Perhaps that is smaller thanfieldCount
.
I tried to run it with the returned number of fields, but got the same error.
Here's my new theory. The pointers in row
come from chopByChar()
in common.c. It's a little tricky in that it populates row
with pointers from within the cloned parent string. Thus, only the first element in row
points to a free()
able string, allocated by malloc()
. The other strings pointed to by row
will be freed when you free the first string.
See this for some explanation: https://stackoverflow.com/questions/20297524/c-free-invalid-pointer
Here's my new theory. The pointers in
row
come fromchopByChar()
in common.c. It's a little tricky in that it populatesrow
with pointers from within the cloned parent string. Thus, only the first element inrow
points to afree()
able string, allocated bymalloc()
. The other strings pointed to byrow
will be freed when you free the first string.See this for some explanation: https://stackoverflow.com/questions/20297524/c-free-invalid-pointer
Thanks, this solved the problem.
As I told you
bigBedIntervalToRow
internally allocating memory withcloneString
bigBedIntervalToRow Calling statement
bigBedIntervalToRow Body
I tried to free it with below code
but R throw this error at run-time