}
PAKFIRE_EXPORT void pakfire_file_set_user(PakfireFile file, const char* user) {
- file->user = strdup(user);
+ if (file->user) {
+ free(file->user);
+ file->user = NULL;
+ }
+
+ if (user)
+ file->user = strdup(user);
}
PAKFIRE_EXPORT const char* pakfire_file_get_group(PakfireFile file) {
}
PAKFIRE_EXPORT void pakfire_file_set_group(PakfireFile file, const char* group) {
- file->group = strdup(group);
+ if (file->group) {
+ free(file->group);
+ file->group = NULL;
+ }
+
+ if (group)
+ file->group = strdup(group);
}
PAKFIRE_EXPORT mode_t pakfire_file_get_mode(PakfireFile file) {
}
PAKFIRE_EXPORT void pakfire_file_set_chksum(PakfireFile file, const char* chksum) {
- file->chksum = strdup(chksum);
+ if (file->chksum) {
+ free(file->chksum);
+ file->chksum = NULL;
+ }
+
+ if (chksum)
+ file->chksum = strdup(chksum);
}