Unless I'm mistaken, this line in md5.c:
memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
is only zeroing the first few bytes of ctx, because sizeof is called on the pointer ctx instead of the struct to which it points. The attached patch resolves this issue.