This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/509-remove-deprecated-version
in repository https://gitbox.apache.org/repos/asf/celix.git


The following commit(s) were added to 
refs/heads/feature/509-remove-deprecated-version by this push:
     new a727b468 Fix incorrect ENOMEM return in rsa_dfi
a727b468 is described below

commit a727b468c6b4ce90395ed1785f5b4bb60da56854
Author: Pepijn Noltes <[email protected]>
AuthorDate: Sat Jan 13 16:04:30 2024 +0100

    Fix incorrect ENOMEM return in rsa_dfi
---
 .../remote_service_admin_dfi/src/import_registration_dfi.c  | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git 
a/bundles/remote_services/remote_service_admin_dfi/src/import_registration_dfi.c
 
b/bundles/remote_services/remote_service_admin_dfi/src/import_registration_dfi.c
index d45ea961..99880351 100644
--- 
a/bundles/remote_services/remote_service_admin_dfi/src/import_registration_dfi.c
+++ 
b/bundles/remote_services/remote_service_admin_dfi/src/import_registration_dfi.c
@@ -76,6 +76,10 @@ celix_status_t importRegistration_create(
         FILE *logFile,
         import_registration_t **out) {
     import_registration_t *reg = calloc(1, sizeof(*reg));
+    if (!reg) {
+        return CELIX_ENOMEM;
+    }
+
     reg->context = context;
     reg->endpoint = endpoint;
     reg->classObject = classObject;
@@ -95,14 +99,13 @@ celix_status_t importRegistration_create(
     reg->logFile = logFile;
 
 
-    if (reg && reg->version && reg->proxies && reg->interceptorsHandler) {
-        //printf("IMPORT REGISTRATION IS %p\n", reg);
-        *out = reg;
+    if (!reg->version || !reg->proxies || !reg->interceptorsHandler) {
+        importRegistration_destroy(reg);
         return CELIX_ENOMEM;
-    } else {
-       importRegistration_destroy(reg);
+
     }
 
+    *out = reg;
     return CELIX_SUCCESS;
 }
 

Reply via email to