{"action":"created","issue":{"url":"https://api.github.com/repos/sass/libsass/issues/1446","labels_url":"https://api.github.com/repos/sass/libsass/issues/1446/labels{/name}","comments_url":"https://api.github.com/repos/sass/libsass/issues/1446/comments","events_url":"https://api.github.com/repos/sass/libsass/issues/1446/events","html_url":"https://github.com/sass/libsass/pull/1446","id":101166897,"number":1446,"title":"MemoryManager: Use free instead of delete.","user":{"login":"am11","id":3840695,"avatar_url":"https://avatars.githubusercontent.com/u/3840695?v=3","gravatar_id":"","url":"https://api.github.com/users/am11","html_url":"https://github.com/am11","followers_url":"https://api.github.com/users/am11/followers","following_url":"https://api.github.com/users/am11/following{/other_user}","gists_url":"https://api.github.com/users/am11/gists{/gist_id}","starred_url":"https://api.github.com/users/am11/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/am11/subscriptions","organizations_url":"https://api.github.com/users/am11/orgs","repos_url":"https://api.github.com/users/am11/repos","events_url":"https://api.github.com/users/am11/events{/privacy}","received_events_url":"https://api.github.com/users/am11/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-15T11:21:11Z","updated_at":"2015-08-15T11:59:21Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/sass/libsass/pulls/1446","html_url":"https://github.com/sass/libsass/pull/1446","diff_url":"https://github.com/sass/libsass/pull/1446.diff","patch_url":"https://github.com/sass/libsass/pull/1446.patch"},"body":"On instantiating `Color` at src/functions.cpp (`BUILT_IN(rgba_4)` body)\r\n, `Memory_Manager`'s `operator new()` is called which after explicitly\r\ncalling the underlying `operator new(size_t)`, `static_cast` the\r\nallocated memory for `void*` -> `AST_Node*` conversion.\r\n\r\nThe `delete` operator in `Memory_Manager` is called when an exception\r\nis thrown during the construction of the object (right after the `new`)\r\n. When calling underlying `delete` from custom `delete` implementation,\r\nit throws access violation probably because it tries to `delete` all\r\ncontinents of objects which weren't initialised properly, as in case of\r\ninvalid rgba value, `error_handling` layer throws.\r\n\r\nTherefore, more rawer `free()` is used to avoid `bad_alloc`<->`delete`\r\npanics. :)\r\n\r\nNote that this is the quick fix to the problem. The actual fix would be\r\nto implement a custom exception-tolerant `New`.\r\n\r\nRead more on this subject:\r\nhttp://www.scs.stanford.edu/~dm/home/papers/c++-new.html.\r\n\r\nFixes #1443."},"comment":{"url":"https://api.github.com/repos/sass/libsass/issues/comments/131360435","html_url":"https://github.com/sass/libsass/pull/1446#issuecomment-131360435","issue_url":"https://api.github.com/repos/sass/libsass/issues/1446","id":131360435,"user":{"login":"am11","id":3840695,"avatar_url":"https://avatars.githubusercontent.com/u/3840695?v=3","gravatar_id":"","url":"https://api.github.com/users/am11","html_url":"https://github.com/am11","followers_url":"https://api.github.com/users/am11/followers","following_url":"https://api.github.com/users/am11/following{/other_user}","gists_url":"https://api.github.com/users/am11/gists{/gist_id}","starred_url":"https://api.github.com/users/am11/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/am11/subscriptions","organizations_url":"https://api.github.com/users/am11/orgs","repos_url":"https://api.github.com/users/am11/repos","events_url":"https://api.github.com/users/am11/events{/privacy}","received_events_url":"https://api.github.com/users/am11/received_events","type":"User","site_admin":false},"created_at":"2015-08-15T11:59:21Z","updated_at":"2015-08-15T11:59:21Z","body":"/cc @mgreter: PTAL"}}