patch-src_amitk_common_c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. $OpenBSD: patch-src_amitk_common_c,v 1.3 2014/04/03 19:53:07 brad Exp $
  2. --- src/amitk_common.c.orig Thu Jan 23 16:47:18 2014
  3. +++ src/amitk_common.c Thu Mar 27 03:45:41 2014
  4. @@ -275,25 +275,37 @@ gboolean amitk_is_xif_directory(const gchar * filename
  5. return TRUE;
  6. }
  7. - g_free(temp_str);
  8. -
  9. + if (temp_str) {
  10. + g_free(temp_str);
  11. + }
  12. +
  13. /* figure out the name of the study file */
  14. - directory = opendir(xifname);
  15. -
  16. + if (xifname) {
  17. + directory = opendir(xifname);
  18. + }
  19. /* currently, only looks at the first study_*.xml file... there should be only one anyway */
  20. if (directory != NULL) {
  21. while (((directory_entry = readdir(directory)) != NULL))
  22. if (g_pattern_match_simple("study_*.xml", directory_entry->d_name)) {
  23. if (plegacy1 != NULL) *plegacy1 = FALSE;
  24. if (pxml_filename != NULL) *pxml_filename = g_strdup(directory_entry->d_name);
  25. - closedir(directory);
  26. -
  27. + if (directory) {
  28. + closedir(directory);
  29. + }
  30. + if (xifname) {
  31. + g_free(xifname);
  32. + }
  33. return TRUE;
  34. }
  35. }
  36. - closedir(directory);
  37. -
  38. + if (directory) {
  39. + closedir(directory);
  40. + }
  41. + if (xifname) {
  42. + g_free(xifname);
  43. + }
  44. +
  45. return FALSE;
  46. }