From: Alex Henrie alexhenrie24@gmail.com
--- server/file.h | 44 ++++++++++++++++++++++++-------------------- server/object.h | 20 ++++++++++---------- server/process.h | 2 +- server/thread.h | 2 +- server/unicode.h | 4 ++-- 5 files changed, 38 insertions(+), 34 deletions(-)
diff --git a/server/file.h b/server/file.h index 0ffe0e2c8dc..fb83c958626 100644 --- a/server/file.h +++ b/server/file.h @@ -79,14 +79,14 @@ struct fd_ops /* file descriptor functions */
extern struct fd *alloc_pseudo_fd( const struct fd_ops *fd_user_ops, struct object *user, - unsigned int options ); + unsigned int options ) __WINE_MALLOC; extern struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_name, int flags, mode_t *mode, unsigned int access, - unsigned int sharing, unsigned int options ); + unsigned int sharing, unsigned int options ) __WINE_MALLOC; extern struct fd *create_anonymous_fd( const struct fd_ops *fd_user_ops, - int unix_fd, struct object *user, unsigned int options ); + int unix_fd, struct object *user, unsigned int options ) __WINE_MALLOC; extern struct fd *dup_fd_object( struct fd *orig, unsigned int access, unsigned int sharing, - unsigned int options ); + unsigned int options ) __WINE_MALLOC; extern struct fd *get_fd_object_for_mapping( struct fd *fd, unsigned int access, unsigned int sharing ); extern void *get_fd_user( struct fd *fd ); extern void set_fd_user( struct fd *fd, const struct fd_ops *ops, struct object *user ); @@ -102,7 +102,7 @@ extern obj_handle_t lock_fd( struct fd *fd, file_pos_t offset, file_pos_t count, extern void unlock_fd( struct fd *fd, file_pos_t offset, file_pos_t count ); extern void allow_fd_caching( struct fd *fd ); extern void set_fd_signaled( struct fd *fd, int signaled ); -extern char *dup_fd_name( struct fd *root, const char *name ); +extern char *dup_fd_name( struct fd *root, const char *name ) __WINE_DEALLOC(free) __WINE_MALLOC; extern void get_nt_name( struct fd *fd, struct unicode_str *name );
extern int default_fd_signaled( struct object *obj, struct wait_queue_entry *entry ); @@ -152,8 +152,9 @@ static inline timeout_t abstime_to_timeout( abstime_t abstime ) }
extern void set_current_time( void ); -extern struct timeout_user *add_timeout_user( timeout_t when, timeout_callback func, void *private ); extern void remove_timeout_user( struct timeout_user *user ); +extern struct timeout_user *add_timeout_user( timeout_t when, timeout_callback func, + void *private ) __WINE_DEALLOC(remove_timeout_user) __WINE_MALLOC; extern const char *get_timeout_str( timeout_t timeout );
/* file functions */ @@ -161,10 +162,11 @@ extern const char *get_timeout_str( timeout_t timeout ); extern struct file *get_file_obj( struct process *process, obj_handle_t handle, unsigned int access ); extern int get_file_unix_fd( struct file *file ); -extern struct file *create_file_for_fd( int fd, unsigned int access, unsigned int sharing ); -extern struct file *create_file_for_fd_obj( struct fd *fd, unsigned int access, unsigned int sharing ); +extern struct file *create_file_for_fd( int fd, unsigned int access, unsigned int sharing ) __WINE_MALLOC; +extern struct file *create_file_for_fd_obj( struct fd *fd, unsigned int access, unsigned int sharing ) __WINE_MALLOC; extern void file_set_error(void); -extern struct security_descriptor *mode_to_sd( mode_t mode, const struct sid *user, const struct sid *group ); +extern struct security_descriptor *mode_to_sd( mode_t mode, const struct sid *user, + const struct sid *group ) __WINE_DEALLOC(free) __WINE_MALLOC; extern mode_t sd_to_mode( const struct security_descriptor *sd, const struct sid *owner ); extern int is_file_executable( const char *name );
@@ -181,28 +183,28 @@ extern int get_view_nt_name( const struct memory_view *view, struct unicode_str extern void free_mapped_views( struct process *process ); extern int get_page_size(void); extern struct mapping *create_fd_mapping( struct object *root, const struct unicode_str *name, struct fd *fd, - unsigned int attr, const struct security_descriptor *sd ); + unsigned int attr, const struct security_descriptor *sd ) __WINE_MALLOC; extern struct object *create_user_data_mapping( struct object *root, const struct unicode_str *name, - unsigned int attr, const struct security_descriptor *sd ); + unsigned int attr, const struct security_descriptor *sd ) __WINE_MALLOC;
/* device functions */
extern struct object *create_named_pipe_device( struct object *root, const struct unicode_str *name, - unsigned int attr, const struct security_descriptor *sd ); + unsigned int attr, const struct security_descriptor *sd ) __WINE_MALLOC; extern struct object *create_mailslot_device( struct object *root, const struct unicode_str *name, - unsigned int attr, const struct security_descriptor *sd ); + unsigned int attr, const struct security_descriptor *sd ) __WINE_MALLOC; extern struct object *create_console_device( struct object *root, const struct unicode_str *name, - unsigned int attr, const struct security_descriptor *sd ); + unsigned int attr, const struct security_descriptor *sd ) __WINE_MALLOC; extern struct object *create_socket_device( struct object *root, const struct unicode_str *name, - unsigned int attr, const struct security_descriptor *sd ); + unsigned int attr, const struct security_descriptor *sd ) __WINE_MALLOC; extern struct object *create_unix_device( struct object *root, const struct unicode_str *name, - unsigned int attr, const struct security_descriptor *sd, const char *unix_path ); + unsigned int attr, const struct security_descriptor *sd, const char *unix_path ) __WINE_MALLOC;
/* change notification functions */
extern void do_change_notify( int unix_fd ); extern void sigio_callback(void); -extern struct object *create_dir_obj( struct fd *fd, unsigned int access, mode_t mode ); +extern struct object *create_dir_obj( struct fd *fd, unsigned int access, mode_t mode ) __WINE_MALLOC; extern struct dir *get_dir_obj( struct process *process, obj_handle_t handle, unsigned int access );
/* completion */ @@ -214,15 +216,17 @@ extern void add_completion( struct completion *completion, apc_param_t ckey, apc /* serial port functions */
extern int is_serial_fd( struct fd *fd ); -extern struct object *create_serial( struct fd *fd ); +extern struct object *create_serial( struct fd *fd ) __WINE_MALLOC;
/* async I/O functions */
typedef void (*async_completion_callback)( void *private );
extern void free_async_queue( struct async_queue *queue ); -extern struct async *create_async( struct fd *fd, struct thread *thread, const async_data_t *data, struct iosb *iosb ); -extern struct async *create_request_async( struct fd *fd, unsigned int comp_flags, const async_data_t *data ); +extern struct async *create_async( struct fd *fd, struct thread *thread, const async_data_t *data, + struct iosb *iosb ) __WINE_MALLOC; +extern struct async *create_request_async( struct fd *fd, unsigned int comp_flags, + const async_data_t *data ) __WINE_MALLOC; extern obj_handle_t async_handoff( struct async *async, data_size_t *result, int force_blocking ); extern void queue_async( struct async_queue *queue, struct async *async ); extern void async_set_timeout( struct async *async, timeout_t timeout, unsigned int status ); diff --git a/server/object.h b/server/object.h index f156f1d2f13..4449072a796 100644 --- a/server/object.h +++ b/server/object.h @@ -139,19 +139,19 @@ struct wait_queue_entry struct thread_wait *wait; };
-extern void *mem_alloc( size_t size ); /* malloc wrapper */ -extern void *memdup( const void *data, size_t len ); -extern void *alloc_object( const struct object_ops *ops ); +extern void *mem_alloc( size_t size ) __WINE_ALLOC_SIZE(1) __WINE_DEALLOC(free) __WINE_MALLOC; +extern void *memdup( const void *data, size_t len ) __WINE_ALLOC_SIZE(2) __WINE_DEALLOC(free) __WINE_MALLOC; +extern void *alloc_object( const struct object_ops *ops ) __WINE_MALLOC; extern void namespace_add( struct namespace *namespace, struct object_name *ptr ); extern const WCHAR *get_object_name( struct object *obj, data_size_t *len ); -extern WCHAR *default_get_full_name( struct object *obj, data_size_t *ret_len ); +extern WCHAR *default_get_full_name( struct object *obj, data_size_t *ret_len ) __WINE_DEALLOC(free) __WINE_MALLOC; extern void dump_object_name( struct object *obj ); extern struct object *lookup_named_object( struct object *root, const struct unicode_str *name, unsigned int attr, struct unicode_str *name_left ); extern data_size_t get_path_element( const WCHAR *name, data_size_t len ); extern void *create_named_object( struct object *parent, const struct object_ops *ops, const struct unicode_str *name, unsigned int attributes, - const struct security_descriptor *sd ); + const struct security_descriptor *sd ) __WINE_MALLOC; extern void *open_named_object( struct object *parent, const struct object_ops *ops, const struct unicode_str *name, unsigned int attributes ); extern void unlink_named_object( struct object *obj ); @@ -207,9 +207,9 @@ struct keyed_event;
extern struct event *create_event( struct object *root, const struct unicode_str *name, unsigned int attr, int manual_reset, int initial_state, - const struct security_descriptor *sd ); + const struct security_descriptor *sd ) __WINE_MALLOC; extern struct keyed_event *create_keyed_event( struct object *root, const struct unicode_str *name, - unsigned int attr, const struct security_descriptor *sd ); + unsigned int attr, const struct security_descriptor *sd ) __WINE_MALLOC; extern struct event *get_event_obj( struct process *process, obj_handle_t handle, unsigned int access ); extern struct keyed_event *get_keyed_event_obj( struct process *process, obj_handle_t handle, unsigned int access ); extern void set_event( struct event *event ); @@ -280,13 +280,13 @@ extern void init_directories( struct fd *intl_fd ); /* symbolic link functions */
extern struct object *create_root_symlink( struct object *root, const struct unicode_str *name, - unsigned int attr, const struct security_descriptor *sd ); + unsigned int attr, const struct security_descriptor *sd ) __WINE_MALLOC; extern struct object *create_obj_symlink( struct object *root, const struct unicode_str *name, unsigned int attr, struct object *target, - const struct security_descriptor *sd ); + const struct security_descriptor *sd ) __WINE_MALLOC; extern struct object *create_symlink( struct object *root, const struct unicode_str *name, unsigned int attr, const struct unicode_str *target, - const struct security_descriptor *sd ); + const struct security_descriptor *sd ) __WINE_MALLOC;
/* global variables */
diff --git a/server/process.h b/server/process.h index 97e0d455ece..ff43ba57bf6 100644 --- a/server/process.h +++ b/server/process.h @@ -94,7 +94,7 @@ extern void free_ptid( unsigned int id ); extern void *get_ptid_entry( unsigned int id ); extern struct process *create_process( int fd, struct process *parent, unsigned int flags, const startup_info_t *info, const struct security_descriptor *sd, const obj_handle_t *handles, - unsigned int handle_count, struct token *token ); + unsigned int handle_count, struct token *token ) __WINE_MALLOC; extern data_size_t get_process_startup_info_size( struct process *process ); extern struct thread *get_process_first_thread( struct process *process ); extern struct process *get_process_from_id( process_id_t id ); diff --git a/server/thread.h b/server/thread.h index 8dcf966a90a..d9d132fcd3b 100644 --- a/server/thread.h +++ b/server/thread.h @@ -97,7 +97,7 @@ extern struct thread *current; /* thread functions */
extern struct thread *create_thread( int fd, struct process *process, - const struct security_descriptor *sd ); + const struct security_descriptor *sd ) __WINE_MALLOC; extern struct thread *get_thread_from_id( thread_id_t id ); extern struct thread *get_thread_from_handle( obj_handle_t handle, unsigned int access ); extern struct thread *get_thread_from_tid( int tid ); diff --git a/server/unicode.h b/server/unicode.h index e031d6ef0cf..4dce910b504 100644 --- a/server/unicode.h +++ b/server/unicode.h @@ -28,9 +28,9 @@
extern int memicmp_strW( const WCHAR *str1, const WCHAR *str2, data_size_t len ); extern unsigned int hash_strW( const WCHAR *str, data_size_t len, unsigned int hash_size ); -extern WCHAR *ascii_to_unicode_str( const char *str, struct unicode_str *ret ); +extern WCHAR *ascii_to_unicode_str( const char *str, struct unicode_str *ret ) __WINE_DEALLOC(free) __WINE_MALLOC; extern int parse_strW( WCHAR *buffer, data_size_t *len, const char *src, char endchar ); extern int dump_strW( const WCHAR *str, data_size_t len, FILE *f, const char escape[2] ); -extern struct fd *load_intl_file(void); +extern struct fd *load_intl_file(void) __WINE_MALLOC;
#endif /* __WINE_SERVER_UNICODE_H */
Alexandre Julliard (@julliard) commented about server/file.h:
/* file descriptor functions */
extern struct fd *alloc_pseudo_fd( const struct fd_ops *fd_user_ops, struct object *user,
unsigned int options );
unsigned int options ) __WINE_MALLOC;
extern struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_name, int flags, mode_t *mode, unsigned int access,
unsigned int sharing, unsigned int options );
unsigned int sharing, unsigned int options ) __WINE_MALLOC;
__WINE_MALLOC is not appropriate for functions that return initialized objects.