summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cpukit/ChangeLog5
-rw-r--r--cpukit/libfs/src/imfs/memfile.c16
2 files changed, 14 insertions, 7 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog
index c56650f2d9..e10ad143a7 100644
--- a/cpukit/ChangeLog
+++ b/cpukit/ChangeLog
@@ -1,5 +1,10 @@
2010-01-18 Joel Sherrill <joel.sherrill@oarcorp.com>
+ Coverity Id 12
+ * libfs/src/imfs/memfile.c: Check for NULL return value.
+
+2010-01-18 Joel Sherrill <joel.sherrill@oarcorp.com>
+
Coverity Id 19
Coverity Id 20
Coverity Id 21
diff --git a/cpukit/libfs/src/imfs/memfile.c b/cpukit/libfs/src/imfs/memfile.c
index 08c426d5da..e0429b3e92 100644
--- a/cpukit/libfs/src/imfs/memfile.c
+++ b/cpukit/libfs/src/imfs/memfile.c
@@ -7,7 +7,7 @@
* at system shutdown unless special arrangements to copy the data to
* some type of non-volailte storage are made by the application.
*
- * COPYRIGHT (c) 1989-1999.
+ * COPYRIGHT (c) 1989-2010.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -399,14 +399,16 @@ MEMFILE_STATIC int IMFS_memfile_remove_block(
unsigned int block
)
{
- block_p *block_entry_ptr;
+ block_p *block_ptr;
block_p ptr;
- block_entry_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 0 );
- ptr = *block_entry_ptr;
- *block_entry_ptr = 0;
-
- memfile_free_block( ptr );
+ block_ptr = IMFS_memfile_get_block_pointer( the_jnode, block, 0 );
+ assert( block_ptr );
+ if ( block_ptr ) {
+ ptr = *block_ptr;
+ *block_ptr = 0;
+ memfile_free_block( ptr );
+ }
return 1;
}