From: <dg...@su...> - 2009-01-11 02:48:47
|
Author: dgollub Date: Sun Jan 11 03:48:10 2009 New Revision: 5092 URL: http://www.opensync.org/changeset/5092 Log: Return NULL if size or data is NULL. Modified: trunk/opensync/format/opensync_objformat.c trunk/opensync/format/opensync_objformat.h Modified: trunk/opensync/format/opensync_objformat.c ============================================================================== --- trunk/opensync/format/opensync_objformat.c Sun Jan 11 03:39:34 2009 (r5091) +++ trunk/opensync/format/opensync_objformat.c Sun Jan 11 03:48:10 2009 (r5092) @@ -222,6 +222,8 @@ char *osync_objformat_print(OSyncObjFormat *format, const char *data, unsigned int size) { osync_return_val_if_fail(format, NULL); + osync_return_val_if_fail(data, NULL); + osync_return_val_if_fail(size, NULL); if (!format->print_func) return g_strndup(data, size); Modified: trunk/opensync/format/opensync_objformat.h ============================================================================== --- trunk/opensync/format/opensync_objformat.h Sun Jan 11 03:39:34 2009 (r5091) +++ trunk/opensync/format/opensync_objformat.h Sun Jan 11 03:48:10 2009 (r5092) @@ -252,7 +252,8 @@ * @param format Pointer to the object format * @param data Pointer to the object to destroy * @param size Size in bytes of the object specified by the data parameter - * @returns Human readable string of the specified object. Caller is responsible for freeing the string + * @returns Human readable string of the specified object. Caller is responsible for freeing the string. + * Or NULL if size is 0 or data NULL. */ OSYNC_EXPORT char *osync_objformat_print(OSyncObjFormat *format, const char *data, unsigned int size); |