diff --git a/src/rm/RequestManagerImageEnable.cc b/src/rm/RequestManagerImageEnable.cc index cdeafff1ec..6d5cec9dcb 100644 --- a/src/rm/RequestManagerImageEnable.cc +++ b/src/rm/RequestManagerImageEnable.cc @@ -104,10 +104,12 @@ error_image_get: error_authorization: oss << "[ImageEnable] User not authorized to enable/disable image" << " attributes, aborting call."; + image->unlock(); goto error_common; error_enable: oss << "[ImageEnable] Cannot enable/disable image [" << iid << "]"; + image->unlock(); goto error_common; error_common: diff --git a/src/rm/RequestManagerImageInfo.cc b/src/rm/RequestManagerImageInfo.cc index b206a63892..37beb6927c 100644 --- a/src/rm/RequestManagerImageInfo.cc +++ b/src/rm/RequestManagerImageInfo.cc @@ -84,6 +84,7 @@ error_image_get: error_authenticate: oss << "User doesn't exist, or not authorized to use image with " << "ID = " << iid << " , ImageInfo call aborted."; + image->unlock(); goto error_common; error_common: diff --git a/src/rm/RequestManagerImagePublish.cc b/src/rm/RequestManagerImagePublish.cc index 75c7b62108..f88c328b72 100644 --- a/src/rm/RequestManagerImagePublish.cc +++ b/src/rm/RequestManagerImagePublish.cc @@ -98,6 +98,7 @@ error_image_get: error_authorization: oss << "[ImagePublish] User not authorized to publish/unpublish image" << ", aborting call."; + image->unlock(); goto error_common; error_common: diff --git a/src/rm/RequestManagerImageRemoveAttribute.cc b/src/rm/RequestManagerImageRemoveAttribute.cc index e016be610c..c04db2eed0 100644 --- a/src/rm/RequestManagerImageRemoveAttribute.cc +++ b/src/rm/RequestManagerImageRemoveAttribute.cc @@ -103,11 +103,13 @@ error_image_get: error_authorization: oss << "[ImageRemoveAttribute] User not authorized to remove image" << " attributes aborting call."; + image->unlock(); goto error_common; error_remove_attribute: oss << "[ImageRemoveAttribute] Cannot remove attribute with name = " << name << " for image [" << iid << "]"; + image->unlock(); goto error_common; error_common: diff --git a/src/rm/RequestManagerImageUpdate.cc b/src/rm/RequestManagerImageUpdate.cc index 8ad1f6e6c1..7145ec9768 100644 --- a/src/rm/RequestManagerImageUpdate.cc +++ b/src/rm/RequestManagerImageUpdate.cc @@ -109,10 +109,12 @@ error_image_get: error_authorization: oss << "User not authorized to modify image attributes " << ", aborting ImageUpdate call."; + image->unlock(); goto error_common; error_update: oss << "Cannot modify image [" << iid << "] attribute with name = " << name; + image->unlock(); goto error_common; error_common: diff --git a/src/rm/RequestManagerVirtualNetworkPublish.cc b/src/rm/RequestManagerVirtualNetworkPublish.cc index 5c5cfadfc4..985ae289b0 100644 --- a/src/rm/RequestManagerVirtualNetworkPublish.cc +++ b/src/rm/RequestManagerVirtualNetworkPublish.cc @@ -98,6 +98,7 @@ error_vn_get: error_authorization: oss << "[VirtualNetworkPublish] User not authorized to (un)publish VN" << ", aborting call."; + vn->unlock(); goto error_common; error_common: diff --git a/src/template/TemplateSQL.cc b/src/template/TemplateSQL.cc index 105f7c9d7a..05f26caa82 100644 --- a/src/template/TemplateSQL.cc +++ b/src/template/TemplateSQL.cc @@ -50,19 +50,8 @@ int TemplateSQL::insert_cb(void *nil, int num, char **values, char **names) int TemplateSQL::insert(SqlDB * db) { - ostringstream oss; int rc; - // Get next id from the DB table - set_callback( - static_cast(&TemplateSQL::insert_cb)); - - oss << "SELECT MAX(id) FROM " << table; - - rc = db->exec(oss,this); - - unset_callback(); - if ( rc != 0 ) { return -1;