Hi Bill,

On Thu, 2015-08-20 at 14:51 -0700, Bill Parker wrote:
> Hello All,
> 
>     In reviewing source code in linuxptp-1.5, I found several
> instances
> where the return values for calls to malloc()/calloc()/strdup() are
> not
> checked for a return value of NULL, indicating failure.  This is in
> file
> 'timemaster.c', and the patch file below should address these issues,
> and also free()'s previously allocated memory in the order it was
> allocated:
> 

It is common practice for this list to use git-send-email to generate
the patch, rather than creating the email by hand. Then the subject of
the email could be the commit message. You can also use --- scissors
feature to include comments that may not be valid inside a commit
message but should appear on the mailing list. That being said, this
patch looks ok.

One general comment is for blocks which have early returns it may be
worth using a "goto err_xyz;" style instead of copying error
recovery/handling. This often can simplify the "undo the stuff we
already did as we exit" to reduce repeated code (which is a likely
place to add memory leaks in the future as code changes).

I couldn't easily tell if any of the blocks would really benefit from
this or not, but it is something to think about.

<snip>

> 
> running 'make' in the linuxptp-1.5 source tree (with the code added
> above) results in a clean build, btw.
> 
> I am attaching the patch file (diff -u format) to this bug report...
> 
> Comments, Questions, Complaints, Suggestions? :)


Thanks for the patch!

Regards,
Jake
------------------------------------------------------------------------------
_______________________________________________
Linuxptp-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-users

Reply via email to