summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2012-11-22 14:08:38 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2012-11-22 16:35:06 +0100
commit82eb2c4d5f89893d35c841387fa8631ed31364ab (patch)
tree858d97d0cd8e8a81265145f9fb9913ff486e20a0
parentm68k/mrm332: Delete _Internal_error_Occurred() (diff)
downloadrtems-82eb2c4d5f89893d35c841387fa8631ed31364ab.tar.bz2
ftpfs: Fix NULL pointer access
-rw-r--r--cpukit/libnetworking/lib/ftpfs.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/cpukit/libnetworking/lib/ftpfs.c b/cpukit/libnetworking/lib/ftpfs.c
index 5ba7515400..6ce25435c5 100644
--- a/cpukit/libnetworking/lib/ftpfs.c
+++ b/cpukit/libnetworking/lib/ftpfs.c
@@ -1148,16 +1148,20 @@ static void rtems_ftpfs_eval_path(
static void rtems_ftpfs_free_node(const rtems_filesystem_location_info_t *loc)
{
rtems_ftpfs_entry *e = loc->node_access;
- const rtems_ftpfs_mount_entry *me = loc->mt_entry->fs_info;
- /* Close control connection if necessary */
- if (e->ctrl_socket >= 0) {
- rtems_ftpfs_send_command(e, "QUIT", NULL, me->verbose);
+ /* The root node handler has no entry */
+ if (e != NULL) {
+ const rtems_ftpfs_mount_entry *me = loc->mt_entry->fs_info;
- close(e->ctrl_socket);
- }
+ /* Close control connection if necessary */
+ if (e->ctrl_socket >= 0) {
+ rtems_ftpfs_send_command(e, "QUIT", NULL, me->verbose);
- free(e);
+ close(e->ctrl_socket);
+ }
+
+ free(e);
+ }
}
static rtems_filesystem_node_types_t rtems_ftpfs_node_type(