I think that this patch aims and fixes the ussue described in the bug 21334 (assigmment simultaniously with "non-constant" method). I'm not sure if there are other issues that lead to double free in basic_string but I not know of them.