summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--git.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/git.c b/git.c
index 9632d21..3c84378 100644
--- a/git.c
+++ b/git.c
@@ -69,11 +69,27 @@ pull_request *get_pull_request(int id, const char *root) {
}
int create_info(pull_request *pr, const char *pr_dir) {
- int len = strlen(pr_dir) + strlen("/info");
- char *info = calloc(len+1, sizeof(char));
+ int len;
+ int buf_len;
+ char *info;
char *info_buf;
FILE *fp;
+ /* Is the PR NULL? */
+ if (pr == NULL) {
+ log(LOG_ERR,"Pull request is NULL.");
+ return 0;
+ }
+ /* Is the PR directory NULL? */
+ if (pr_dir == NULL) {
+ log(LOG_ERR,"Pull request directory is NULL.");
+ return 0;
+ }
+
+ len = strlen(pr_dir) + strlen("/info");
+ buf_len = get_info_len(pr);
+ info = calloc(len+1, sizeof(char));
+
/* Append /info to the PR directory. */
sprintf(info, "%s/info", pr_dir);