]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blobdiff - lib/ss/invocation.c
libss: fix memory handling errors
[thirdparty/e2fsprogs.git] / lib / ss / invocation.c
index a7110500e42e3fe4248f413cc0461e0dc922e1c9..08b66f280f6fd8acb22a582e6e70e1356282e1a8 100644 (file)
@@ -20,6 +20,7 @@
 #ifdef HAVE_DLOPEN
 #include <dlfcn.h>
 #endif
+#include <errno.h>
 
 int ss_create_invocation(subsystem_name, version_string, info_ptr,
                         request_table_ptr, code_ptr)
@@ -46,6 +47,10 @@ int ss_create_invocation(subsystem_name, version_string, info_ptr,
                ;
        table = (ss_data **) realloc((char *)table,
                                     ((unsigned)sci_idx+2)*size);
+       if (table == NULL) {
+               *code_ptr = errno;
+               return 0;
+       }
        table[sci_idx+1] = (ss_data *) NULL;
        table[sci_idx] = new_table;