cn-uofbasel / ccn-lite

CCN-lite, a lightweight implementation of the CCNx protocol and its variations
ISC License
74 stars 63 forks source link

memory leak in ccnl_pkt_dup #316

Closed mfrey closed 5 years ago

mfrey commented 5 years ago

Description

There is a potential memory leak in function ccnl_pkt_dup in ccnl-pkt.c

73 struct ccnl_pkt_s *
 74 ccnl_pkt_dup(struct ccnl_pkt_s *pkt){
 75     struct ccnl_pkt_s * ret = ccnl_malloc(sizeof(struct ccnl_pkt_s));
 76     if(!pkt){
 77         return NULL;
 78     }
 79     if(!ret){
 80         return NULL;
 81     }

If the parameter pkt is null and the allocation of memory for ret was successful, the allocated memory is never freed.