Skip to content

Allow repeated invocations of bcf_update_info/format_*()#856

Merged
daviesrob merged 1 commit intosamtools:developfrom
jmarshall:update-reallocs
Apr 17, 2019
Merged

Allow repeated invocations of bcf_update_info/format_*()#856
daviesrob merged 1 commit intosamtools:developfrom
jmarshall:update-reallocs

Conversation

@jmarshall
Copy link
Member

I needed this for something else, hence… Rather than asserting that no value has previously been set, free any previously set value array before unpacking the new one. Fixes #813.

(This free() is all that's left after duplicating the "Mark the tag for removal, free existing memory if necessary" code from earlier in each function, and removing assignments that are unnecessary due to the immediately following bcf_unpack_info/fmt_core1() call.)

Rather than asserting that no value has previously been set, free any
previously set value array before unpacking the new one.  Fixes samtools#813.

(This free() is all that's left after duplicating the "Mark the tag
for removal, free existing memory if necessary" code from earlier in
each function, and removing assignments that are unnecessary due to
the immediately following bcf_unpack_info/fmt_core1() call.)

Add test cases that update to small, large, and finally middle-sized
values, so that both reallocation and reuse are exercised.
@daviesrob daviesrob merged commit 8ab9acf into samtools:develop Apr 17, 2019
@daviesrob
Copy link
Member

Looks like #813 dropped off our radar slightly. Thanks for fixing it.

@jmarshall
Copy link
Member Author

No problem. I was pleasantly surprised that the whole thing evaporated down to just one line!

@jmarshall jmarshall deleted the update-reallocs branch April 17, 2019 10:51
@kevinjacobs-progenity
Copy link

Thanks for this fix. I’ve been too busy to get to it. Any idea when the next release is scheduled?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

htslib 1.9 aborts in bcf_update_format invoked from cyvcf2 autotests

3 participants