In searchJOIN(): abort if recursive call fails.
authorscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 14 May 2009 11:24:59 +0000 (11:24 +0000)
committerscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 14 May 2009 11:24:59 +0000 (11:24 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@13158 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/c-apps/oils_cstore.c

index 4a895bc..8175262 100644 (file)
@@ -2396,9 +2396,18 @@ static char* searchJOIN ( const jsonObject* join_hash, osrfHash* leftmeta ) {
                const jsonObject* join_filter = jsonObjectGetKeyConst( snode, "join" );
                if (join_filter) {
                        char* jpred = searchJOIN( join_filter, idlClass );
-                       OSRF_BUFFER_ADD_CHAR( join_buf, ' ' );
-                       OSRF_BUFFER_ADD( join_buf, jpred );
-                       free(jpred);
+                       if( jpred ) {
+                               OSRF_BUFFER_ADD_CHAR( join_buf, ' ' );
+                               OSRF_BUFFER_ADD( join_buf, jpred );
+                               free(jpred);
+                       } else {
+                               osrfLogError( OSRF_LOG_MARK, "%s: Invalid nested join.", MODULENAME );
+                               jsonIteratorFree( search_itr );
+                               buffer_free( join_buf );
+                               if( freeable_hash )
+                                       jsonObjectFree( freeable_hash );
+                               return NULL;
+                       }
                }
        }