{"action":"created","issue":{"url":"https://api.github.com/repos/mikeizbicki/ucr-cs100/issues/1564","labels_url":"https://api.github.com/repos/mikeizbicki/ucr-cs100/issues/1564/labels{/name}","comments_url":"https://api.github.com/repos/mikeizbicki/ucr-cs100/issues/1564/comments","events_url":"https://api.github.com/repos/mikeizbicki/ucr-cs100/issues/1564/events","html_url":"https://github.com/mikeizbicki/ucr-cs100/issues/1564","id":77393785,"number":1564,"title":"Memory leak","user":{"login":"ZhuLeon","id":11825109,"avatar_url":"https://avatars.githubusercontent.com/u/11825109?v=3","gravatar_id":"","url":"https://api.github.com/users/ZhuLeon","html_url":"https://github.com/ZhuLeon","followers_url":"https://api.github.com/users/ZhuLeon/followers","following_url":"https://api.github.com/users/ZhuLeon/following{/other_user}","gists_url":"https://api.github.com/users/ZhuLeon/gists{/gist_id}","starred_url":"https://api.github.com/users/ZhuLeon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZhuLeon/subscriptions","organizations_url":"https://api.github.com/users/ZhuLeon/orgs","repos_url":"https://api.github.com/users/ZhuLeon/repos","events_url":"https://api.github.com/users/ZhuLeon/events{/privacy}","received_events_url":"https://api.github.com/users/ZhuLeon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-05-17T20:41:03Z","updated_at":"2015-05-17T23:54:58Z","closed_at":null,"body":"So have allocated memory like this: `char** argv = new char*[size]` and then I do this\r\n```\r\nfor(int i =0; argv[i] != NULL; i++)\r\n{\r\n    if (conditon)\r\n       argv[i] = NULL\r\n}\r\n```\r\nThat results in a memory leak. But I have no idea how to deallocated it. I've tried this:\r\n```\r\nfor(int i =0; argv[i] != NULL; i++)\r\n{\r\n    if (conditon)\r\n        for(i = i +1; argv[i] != NULL; i++)\r\n              delete argv[i]\r\n       argv[i] = NULL\r\n}\r\n```\r\nBut I still have a bit of memory leak left"},"comment":{"url":"https://api.github.com/repos/mikeizbicki/ucr-cs100/issues/comments/102871406","html_url":"https://github.com/mikeizbicki/ucr-cs100/issues/1564#issuecomment-102871406","issue_url":"https://api.github.com/repos/mikeizbicki/ucr-cs100/issues/1564","id":102871406,"user":{"login":"nchun003","id":5582238,"avatar_url":"https://avatars.githubusercontent.com/u/5582238?v=3","gravatar_id":"","url":"https://api.github.com/users/nchun003","html_url":"https://github.com/nchun003","followers_url":"https://api.github.com/users/nchun003/followers","following_url":"https://api.github.com/users/nchun003/following{/other_user}","gists_url":"https://api.github.com/users/nchun003/gists{/gist_id}","starred_url":"https://api.github.com/users/nchun003/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nchun003/subscriptions","organizations_url":"https://api.github.com/users/nchun003/orgs","repos_url":"https://api.github.com/users/nchun003/repos","events_url":"https://api.github.com/users/nchun003/events{/privacy}","received_events_url":"https://api.github.com/users/nchun003/received_events","type":"User","site_admin":false},"created_at":"2015-05-17T23:54:58Z","updated_at":"2015-05-17T23:54:58Z","body":"So if right now you're using `execvp(argv[0], argv)`, and if you switch to using `std::vector<char *>argv` then you just use `execvp(argv[0], &argv[0)`. \r\nHere's a link to the question I asked on stackoverflow: http://stackoverflow.com/questions/30291444/valgrind-memory-leak-pointer?noredirect=1#comment48680167_30291444"}}