mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-21 12:33:49 +01:00
Merge pull request #720 from mehlis/fix-leak-on-error
ccnl: fix memory leak on CS error
This commit is contained in:
commit
68bc93b0c7
@ -242,8 +242,12 @@ void ccnl_populate_cache(struct ccnl_relay_s *ccnl, unsigned char *buf, int data
|
|||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
ccnl_content_add2cache(ccnl, c);
|
|
||||||
c->flags |= CCNL_CONTENT_FLAGS_STATIC;
|
c->flags |= CCNL_CONTENT_FLAGS_STATIC;
|
||||||
|
if (!ccnl_content_add2cache(ccnl, c)) {
|
||||||
|
// content store error
|
||||||
|
free_content(c);
|
||||||
|
}
|
||||||
|
|
||||||
Done:
|
Done:
|
||||||
free_prefix(prefix);
|
free_prefix(prefix);
|
||||||
ccnl_free(pkt);
|
ccnl_free(pkt);
|
||||||
|
|||||||
@ -912,7 +912,7 @@ struct ccnl_content_s *
|
|||||||
ccnl_content_remove(struct ccnl_relay_s *ccnl, struct ccnl_content_s *c)
|
ccnl_content_remove(struct ccnl_relay_s *ccnl, struct ccnl_content_s *c)
|
||||||
{
|
{
|
||||||
struct ccnl_content_s *c2;
|
struct ccnl_content_s *c2;
|
||||||
DEBUGMSG(99, "ccnl_content_remove\n");
|
DEBUGMSG(99, "ccnl_content_remove: %s\n", ccnl_prefix_to_path(c->name));
|
||||||
|
|
||||||
c2 = c->next;
|
c2 = c->next;
|
||||||
DBL_LINKED_LIST_REMOVE(ccnl->contents, c);
|
DBL_LINKED_LIST_REMOVE(ccnl->contents, c);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user