From eb5d285ed474f0cc20b968e4a5d590a3b35e52a7 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Sat, 1 Aug 2009 15:02:39 +0100 Subject: Avoid invalid memory accesses in lockdownd_client_new() Valgrind complains: ==2678== Conditional jump or move depends on uninitialised value(s) ==2678== at 0x3ACD40646C: lockdownd_client_new (lockdown.c:662) ==2678== by 0x405BA6: g_vfs_afc_volume_new (afc-volume.c:113) ==2678== by 0x406541: g_vfs_afc_monitor_device_added (afc-volume-monitor.c:46) ==2678== by 0x4066B1: g_vfs_afc_volume_monitor_constructor (afc-volume-monitor.c:173) ==2678== by 0x3A7FE11A38: g_object_newv (in /lib64/libgobject-2.0.so.0.2000.4) ==2678== by 0x3A7FE12584: g_object_new_valist (in /lib64/libgobject-2.0.so.0.2000.4) ==2678== by 0x3A7FE126DB: g_object_new (in /lib64/libgobject-2.0.so.0.2000.4) ==2678== by 0x408AD5: monitor_try_create (gvfsproxyvolumemonitordaemon.c:1651) ==2678== by 0x408C20: g_vfs_proxy_volume_monitor_daemon_main (gvfsproxyvolumemonitordaemon.c:1694) ==2678== by 0x37E881EA2C: (below main) (in /lib64/libc-2.10.1.so) ==2678== Uninitialised value was created by a stack allocation ==2678== at 0x405B00: g_vfs_afc_volume_new (afc-volume.c:138) --- src/lockdown.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/lockdown.c b/src/lockdown.c index 88ab7b0..7a2aa7d 100644 --- a/src/lockdown.c +++ b/src/lockdown.c @@ -659,7 +659,7 @@ lockdownd_error_t lockdownd_get_device_name(lockdownd_client_t client, char **de */ lockdownd_error_t lockdownd_client_new(iphone_device_t device, lockdownd_client_t *client) { - if (!device || !client || (client && *client)) + if (!device || !client) return LOCKDOWN_E_INVALID_ARG; lockdownd_error_t ret = LOCKDOWN_E_SUCCESS; char *host_id = NULL; -- cgit v1.1-32-gdbae