aboutsummaryrefslogtreecommitdiff
path: root/src/main/extractor.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/extractor.c')
-rw-r--r--src/main/extractor.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/main/extractor.c b/src/main/extractor.c
index 7c2981c..6b36410 100644
--- a/src/main/extractor.c
+++ b/src/main/extractor.c
@@ -318,6 +318,8 @@ get_path_from_PATH() {
318 pos = strdup(pos); 318 pos = strdup(pos);
319 free(buf); 319 free(buf);
320 free(path); 320 free(path);
321 if (pos == NULL)
322 return NULL;
321 pos = cut_bin(pos); 323 pos = cut_bin(pos);
322 pos = realloc(pos, strlen(pos) + 5); 324 pos = realloc(pos, strlen(pos) + 5);
323 if (pos == NULL) 325 if (pos == NULL)
@@ -332,6 +334,8 @@ get_path_from_PATH() {
332 pos = strdup(pos); 334 pos = strdup(pos);
333 free(buf); 335 free(buf);
334 free(path); 336 free(path);
337 if (pos == NULL)
338 return NULL;
335 pos = cut_bin(pos); 339 pos = cut_bin(pos);
336 pos = realloc(pos, strlen(pos) + 5); 340 pos = realloc(pos, strlen(pos) + 5);
337 if (pos == NULL) 341 if (pos == NULL)
@@ -503,6 +507,11 @@ find_plugin_in_path (void *cls,
503 continue; 507 continue;
504 sym_name++; 508 sym_name++;
505 sym = strdup (sym_name); 509 sym = strdup (sym_name);
510 if (sym == NULL)
511 {
512 closedir (dir);
513 return;
514 }
506 dot = strstr (sym, "."); 515 dot = strstr (sym, ".");
507 if (dot != NULL) 516 if (dot != NULL)
508 *dot = '\0'; 517 *dot = '\0';
@@ -587,6 +596,11 @@ load_plugins_from_dir (void *cls,
587 continue; 596 continue;
588 sym_name++; 597 sym_name++;
589 sym = strdup (sym_name); 598 sym = strdup (sym_name);
599 if (NULL == sym)
600 {
601 closedir (dir);
602 return;
603 }
590 dot = strstr (sym, "."); 604 dot = strstr (sym, ".");
591 if (dot != NULL) 605 if (dot != NULL)
592 *dot = '\0'; 606 *dot = '\0';
@@ -660,10 +674,17 @@ get_symbol_with_prefix(void *lib_handle,
660 return NULL; 674 return NULL;
661 sym_name++; 675 sym_name++;
662 sym = strdup (sym_name); 676 sym = strdup (sym_name);
677 if (sym == NULL)
678 return NULL;
663 dot = strstr (sym, "."); 679 dot = strstr (sym, ".");
664 if (dot != NULL) 680 if (dot != NULL)
665 *dot = '\0'; 681 *dot = '\0';
666 name = malloc(strlen(sym) + strlen(template) + 1); 682 name = malloc(strlen(sym) + strlen(template) + 1);
683 if (name == NULL)
684 {
685 free (sym);
686 return NULL;
687 }
667 sprintf(name, 688 sprintf(name,
668 template, 689 template,
669 sym); 690 sym);
@@ -685,10 +706,11 @@ get_symbol_with_prefix(void *lib_handle,
685 "`%s' and `%s'.\n", 706 "`%s' and `%s'.\n",
686 name+1, 707 name+1,
687 name, 708 name,
688 first_error, 709 first_error == NULL ? "out of memory" : first_error,
689 lt_dlerror()); 710 lt_dlerror());
690 } 711 }
691 free(first_error); 712 if (first_error != NULL)
713 free(first_error);
692#endif 714#endif
693 } 715 }
694 716
@@ -807,6 +829,11 @@ EXTRACTOR_plugin_add (struct EXTRACTOR_PluginList * prev,
807 result = calloc (1, sizeof (struct EXTRACTOR_PluginList)); 829 result = calloc (1, sizeof (struct EXTRACTOR_PluginList));
808 result->next = prev; 830 result->next = prev;
809 result->short_libname = strdup (library); 831 result->short_libname = strdup (library);
832 if (result->short_libname == NULL)
833 {
834 free (result);
835 return NULL;
836 }
810 result->libname = libname; 837 result->libname = libname;
811 result->flags = flags; 838 result->flags = flags;
812 if (NULL != options) 839 if (NULL != options)
@@ -847,6 +874,8 @@ EXTRACTOR_plugin_add_config (struct EXTRACTOR_PluginList * prev,
847 return prev; 874 return prev;
848 len = strlen(config); 875 len = strlen(config);
849 cpy = strdup(config); 876 cpy = strdup(config);
877 if (cpy == NULL)
878 return prev;
850 pos = 0; 879 pos = 0;
851 last = 0; 880 last = 0;
852 lastconf = 0; 881 lastconf = 0;