|
34 | 34 | typedef struct { |
35 | 35 | git_odb_backend parent; |
36 | 36 |
|
37 | | - const char *prefix; |
38 | | - const char *repo_path; |
| 37 | + char *prefix; |
| 38 | + char *repo_path; |
39 | 39 | redisContext *db; |
40 | 40 | } hiredis_odb_backend; |
41 | 41 |
|
42 | 42 | typedef struct { |
43 | 43 | git_refdb_backend parent; |
44 | 44 |
|
45 | | - const char *prefix; |
46 | | - const char *repo_path; |
| 45 | + char *prefix; |
| 46 | + char *repo_path; |
47 | 47 | redisContext *db; |
48 | 48 | } hiredis_refdb_backend; |
49 | 49 |
|
@@ -215,6 +215,9 @@ void hiredis_odb_backend__free(git_odb_backend *_backend) |
215 | 215 | assert(_backend); |
216 | 216 | backend = (hiredis_odb_backend *) _backend; |
217 | 217 |
|
| 218 | + free(backend->repo_path); |
| 219 | + free(backend->prefix); |
| 220 | + |
218 | 221 | redisFree(backend->db); |
219 | 222 |
|
220 | 223 | free(backend); |
@@ -449,6 +452,9 @@ void hiredis_refdb_backend__free(git_refdb_backend *_backend) |
449 | 452 | assert(_backend); |
450 | 453 | backend = (hiredis_refdb_backend *) _backend; |
451 | 454 |
|
| 455 | + free(backend->repo_path); |
| 456 | + free(backend->prefix); |
| 457 | + |
452 | 458 | redisFree(backend->db); |
453 | 459 |
|
454 | 460 | free(backend); |
@@ -517,8 +523,8 @@ int git_odb_backend_hiredis(git_odb_backend **backend_out, const char* prefix, c |
517 | 523 |
|
518 | 524 | backend->db = sharedConnection; |
519 | 525 |
|
520 | | - backend->prefix = prefix; |
521 | | - backend->repo_path = path; |
| 526 | + backend->prefix = strdup(prefix); |
| 527 | + backend->repo_path = strdup(path); |
522 | 528 |
|
523 | 529 | backend->parent.version = 1; |
524 | 530 |
|
@@ -566,8 +572,8 @@ int git_refdb_backend_hiredis(git_refdb_backend **backend_out, const char* prefi |
566 | 572 |
|
567 | 573 | backend->db = sharedConnection; |
568 | 574 |
|
569 | | - backend->prefix = prefix; |
570 | | - backend->repo_path = path; |
| 575 | + backend->prefix = strdup(prefix); |
| 576 | + backend->repo_path = strdup(path); |
571 | 577 |
|
572 | 578 | backend->parent.exists = &hiredis_refdb_backend__exists; |
573 | 579 | backend->parent.lookup = &hiredis_refdb_backend__lookup; |
|
0 commit comments