diff options
author | Jeremy Allison <jra@samba.org> | 2006-03-27 02:51:25 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:15:45 -0500 |
commit | 4f655c952bc18625b76f07e81518016cba7eee77 (patch) | |
tree | 269e5cba73eca5e9f8d2d2dc94f5515994fc53df | |
parent | 7f57dc61cbf2f421ad9af82164ca0e03c72c5949 (diff) | |
download | samba-4f655c952bc18625b76f07e81518016cba7eee77.tar.gz samba-4f655c952bc18625b76f07e81518016cba7eee77.tar.bz2 samba-4f655c952bc18625b76f07e81518016cba7eee77.zip |
r14743: Fix coverity bug #227. Possible deref of null pointer
in error code path.
Jeremy.
(This used to be commit 9117713c5ee220331106d291425703aec4d7dd2c)
-rw-r--r-- | source3/utils/net_rpc_samsync.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/source3/utils/net_rpc_samsync.c b/source3/utils/net_rpc_samsync.c index 1faa487e45..b1807bb79b 100644 --- a/source3/utils/net_rpc_samsync.c +++ b/source3/utils/net_rpc_samsync.c @@ -1982,22 +1982,27 @@ static NTSTATUS fetch_database_to_ldif(struct rpc_pipe_client *pipe_hnd, done: /* Close and delete the ldif files */ - if (add_file) + if (add_file) { fclose(add_file); - if (strcmp(add_name, add_template) && (unlink(add_name))) { + } + + if ((add_name != NULL) && strcmp(add_name, add_template) && (unlink(add_name))) { DEBUG(1,("unlink(%s) failed, error was (%s)\n", add_name, strerror(errno))); } - if (mod_file) + if (mod_file) { fclose(mod_file); - if (strcmp(mod_name, mod_template) && (unlink(mod_name))) { + } + + if ((mod_name != NULL) && strcmp(mod_name, mod_template) && (unlink(mod_name))) { DEBUG(1,("unlink(%s) failed, error was (%s)\n", mod_name, strerror(errno))); } - if (ldif_file && (ldif_file != stdout)) + if (ldif_file && (ldif_file != stdout)) { fclose(ldif_file); + } /* Deallocate memory for the mapping arrays */ SAFE_FREE(groupmap); |