{"action":"created","issue":{"url":"https://api.github.com/repos/pmem/issues/issues/24","labels_url":"https://api.github.com/repos/pmem/issues/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/pmem/issues/issues/24/comments","events_url":"https://api.github.com/repos/pmem/issues/issues/24/events","html_url":"https://github.com/pmem/issues/issues/24","id":54884770,"number":24,"title":"vmem: memory reallocation to size less than actual returns NULL pointer","user":{"login":"michalsnochowski","id":8243932,"avatar_url":"https://avatars.githubusercontent.com/u/8243932?v=3","gravatar_id":"","url":"https://api.github.com/users/michalsnochowski","html_url":"https://github.com/michalsnochowski","followers_url":"https://api.github.com/users/michalsnochowski/followers","following_url":"https://api.github.com/users/michalsnochowski/following{/other_user}","gists_url":"https://api.github.com/users/michalsnochowski/gists{/gist_id}","starred_url":"https://api.github.com/users/michalsnochowski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michalsnochowski/subscriptions","organizations_url":"https://api.github.com/users/michalsnochowski/orgs","repos_url":"https://api.github.com/users/michalsnochowski/repos","events_url":"https://api.github.com/users/michalsnochowski/events{/privacy}","received_events_url":"https://api.github.com/users/michalsnochowski/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pmem/issues/labels/Exposure:%20High","name":"Exposure: High","color":"fbca04"},{"url":"https://api.github.com/repos/pmem/issues/labels/Priority:%203%20medium","name":"Priority: 3 medium","color":"207de5"},{"url":"https://api.github.com/repos/pmem/issues/labels/Type:%20Bug","name":"Type: Bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-01-20T13:49:01Z","updated_at":"2015-06-22T07:47:40Z","closed_at":null,"body":"Memory reallocation to size less than actual, returns NULL pointer. In general when sum of already allocated memory and desired memory size is bigger than usable pool size, then NULL pointer is returned.\r\n\r\nSteps to reproduce:\r\n1. create valid vmem pool: vmp = vmem_create(\"/mnt/psmem\", VMEM_MIN_POOL);\r\n2. allocate memory: ptr1 = vmem_malloc(vmp, 8 * 1024 * 1024);\r\n3. shrink the memory block: ptr2 = vmem_realloc(vmp, ptr1, 1);\r\n\r\nExpected result:\r\nValid memory pointer should be returned;\r\n\r\nActual result: \r\nNULL pointer is returned;"},"comment":{"url":"https://api.github.com/repos/pmem/issues/issues/comments/114030560","html_url":"https://github.com/pmem/issues/issues/24#issuecomment-114030560","issue_url":"https://api.github.com/repos/pmem/issues/issues/24","id":114030560,"user":{"login":"marcinslusarz","id":12811376,"avatar_url":"https://avatars.githubusercontent.com/u/12811376?v=3","gravatar_id":"","url":"https://api.github.com/users/marcinslusarz","html_url":"https://github.com/marcinslusarz","followers_url":"https://api.github.com/users/marcinslusarz/followers","following_url":"https://api.github.com/users/marcinslusarz/following{/other_user}","gists_url":"https://api.github.com/users/marcinslusarz/gists{/gist_id}","starred_url":"https://api.github.com/users/marcinslusarz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcinslusarz/subscriptions","organizations_url":"https://api.github.com/users/marcinslusarz/orgs","repos_url":"https://api.github.com/users/marcinslusarz/repos","events_url":"https://api.github.com/users/marcinslusarz/events{/privacy}","received_events_url":"https://api.github.com/users/marcinslusarz/received_events","type":"User","site_admin":false},"created_at":"2015-06-22T07:47:40Z","updated_at":"2015-06-22T07:47:40Z","body":"Both patches were merged. Please verify.\r\n"}}