[MDEV-5404] Can't free data returned by mariadb_dyncol_unpack on windows Created: 2013-12-06 Updated: 2014-03-26 Resolved: 2014-03-26 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 10.0.6 |
| Fix Version/s: | 10.0.10 |
| Type: | Bug | Priority: | Major |
| Reporter: | Anders Karlsson | Assignee: | Sergei Golubchik |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows 7 32-bit application using Visual Studio Express 2012 |
||
| Description |
|
Using the libmysql client you can unpack a dynamic column using mariadb_dyncol_unpack(), but the data returned in the column_keys and values needs to be freed after use. It is not documented how to do this (i.e. which free function to call) but neither free(), HeapFree() or mariadb_dyncol_free() works. Looking at the code, sf_malloc is used to allocate the data but I can's see a corresponding function that will free data using sf_free(). |
| Comments |
| Comment by Sergei Golubchik [ 2013-12-06 ] |
|
As far as I understand, you should use my_free() for this. |
| Comment by Anders Karlsson [ 2013-12-06 ] |
|
Sure, that's what I could see in the libmysqld source also. The issue is that my_free() isn't exported from libmysqld, nor is this documented, so I figured it might change and if my_free() really is to be used, then make sure my_free() is exported, make sure my_free() is documented and make sure to document that my_free() should be used for this purpose. |
| Comment by Oleksandr Byelkin [ 2014-01-17 ] |
|
my_free should be used, but I do not understand what should be fixed, documentation? |
| Comment by Anders Karlsson [ 2014-01-17 ] |
|
Two things: Documentation and, on Windows, make sure that my_free is exported from the .dll. The following samle program: int main(int argc, char* argv[]) ; dcv[0].type = DYN_COL_INT; |
| Comment by Sergei Golubchik [ 2014-02-06 ] |
|
Shall we rather provide mariadb_dyncol_unpack_free() for this? That'd be more logical, than explaining to use my_free(). Any better name than mariadb_dyncol_unpack_free()? |
| Comment by Oleksandr Byelkin [ 2014-02-06 ] |
|
mariadb_dyncol_unpack_free() looks quite logical for me... |
| Comment by Sergei Golubchik [ 2014-02-25 ] |
|
karlsson do you think we should provide mariadb_dyncol_unpack_free() or something like that? |
| Comment by Anders Karlsson [ 2014-03-18 ] |
|
Yes, mariadb_dyncol_unpack_free() solves the problem and looks logical. Just make that this is exported from the DLL on Windows (my_free() is not exported on Windows, so on that platform the workaround to just call my_free() doesn't work there. This was true in 10.0.7 at least). |